ByteArrayHelper.java
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.native2pdf.bmc;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
public abstract class ByteArrayHelper {
private static String _id = "IDL:com/adobe/native2pdf/bmc/ByteArray:1.0";
private static TypeCode __typeCode = null;
public static void insert(Any a, byte[] that) {
OutputStream out = a.create_output_stream();
a.type(ByteArrayHelper.type());
ByteArrayHelper.write(out, that);
a.read_value(out.create_input_stream(), ByteArrayHelper.type());
}
public static byte[] extract(Any a) {
return ByteArrayHelper.read(a.create_input_stream());
}
public static synchronized TypeCode type() {
if (__typeCode == null) {
__typeCode = ORB.init().get_primitive_tc(TCKind.tk_octet);
__typeCode = ORB.init().create_sequence_tc(0, __typeCode);
__typeCode = ORB.init().create_alias_tc(ByteArrayHelper.id(), "ByteArray", __typeCode);
}
return __typeCode;
}
public static String id() {
return _id;
}
public static byte[] read(InputStream istream) {
byte[] value = null;
int _len0 = istream.read_long();
value = new byte[_len0];
istream.read_octet_array(value, 0, _len0);
return value;
}
public static void write(OutputStream ostream, byte[] value) {
ostream.write_long(value.length);
ostream.write_octet_array(value, 0, value.length);
}
}