MCPcopy Create free account
hub / github.com/ReadyTalk/avian / ObjectOutputStream

Class ObjectOutputStream

classpath/java/io/ObjectOutputStream.java:19–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17import java.lang.reflect.Modifier;
18
19public class ObjectOutputStream extends OutputStream implements DataOutput {
20 final static short STREAM_MAGIC = (short)0xaced;
21 final static short STREAM_VERSION = 5;
22 final static byte TC_NULL = (byte)0x70;
23 final static byte TC_REFERENCE = (byte)0x71;
24 final static byte TC_CLASSDESC = (byte)0x72;
25 final static byte TC_OBJECT = (byte)0x73;
26 final static byte TC_STRING = (byte)0x74;
27 final static byte TC_ARRAY = (byte)0x75;
28 final static byte TC_CLASS = (byte)0x76;
29 final static byte TC_BLOCKDATA = (byte)0x77;
30 final static byte TC_ENDBLOCKDATA = (byte)0x78;
31 final static byte TC_RESET = (byte)0x79;
32 final static byte TC_BLOCKDATALONG = (byte)0x7a;
33 final static byte TC_EXCEPTION = (byte)0x7b;
34 final static byte TC_LONGSTRING = (byte)0x7c;
35 final static byte TC_PROXYCLASSDESC = (byte)0x7d;
36 final static byte TC_ENUM = (byte)0x7e;
37 final static byte SC_WRITE_METHOD = 0x01; //if SC_SERIALIZABLE
38 final static byte SC_BLOCK_DATA = 0x08; //if SC_EXTERNALIZABLE
39 final static byte SC_SERIALIZABLE = 0x02;
40 final static byte SC_EXTERNALIZABLE = 0x04;
41 final static byte SC_ENUM = 0x10;
42
43 private final OutputStream out;
44
45 public ObjectOutputStream(OutputStream out) throws IOException {
46 this.out = out;
47 rawShort(STREAM_MAGIC);
48 rawShort(STREAM_VERSION);
49 }
50
51 public void write(int c) throws IOException {
52 out.write(c);
53 }
54
55 public void write(byte[] b, int offset, int length) throws IOException {
56 out.write(b, offset, length);
57 }
58
59 public void flush() throws IOException {
60 out.flush();
61 }
62
63 public void close() throws IOException {
64 out.close();
65 }
66
67 private void rawByte(int v) throws IOException {
68 out.write((byte)(v & 0xff));
69 }
70
71 private void rawShort(int v) throws IOException {
72 rawByte(v >> 8);
73 rawByte(v);
74 }
75
76 private void rawInt(int v) throws IOException {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected