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

Method main

test/Serialize.java:119–230  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

117 }
118
119 public static void main(String[] args) throws Exception {
120 ByteArrayOutputStream out = new ByteArrayOutputStream();
121 ObjectOutputStream out2 = new ObjectOutputStream(out);
122 out2.writeBoolean(true);
123 out2.flush();
124 out2.writeByte(17);
125 out2.flush();
126 out2.writeInt(0xcafebabe);
127 out2.flush();
128 out2.writeUTF("Max & Möritz");
129 out2.flush();
130 out2.writeChar('ɛ');
131 out2.flush();
132 out2.writeObject(new Serialize());
133 out2.close();
134 byte[] array = out.toByteArray();
135 expectEqual(array, new int[] {
136 // magic
137 0xac, 0xed,
138 // version
139 0x00, 0x05,
140 // blockdata, length
141 0x77, 0x1,
142 // true
143 1,
144 // blockdata, length
145 0x77, 0x1,
146 // (byte)17
147 17,
148 // blockdata, length
149 0x77, 0x4,
150 // 0xcafebabe
151 0xca, 0xfe, 0xba, 0xbe,
152 // blockdata, length
153 0x77, 0xf,
154 // "Max & Möritz"
155 0x0, 0xd, 'M', 'a', 'x', ' ', '&', ' ', 'M', 0xc3, 0xb6, 'r', 'i', 't', 'z',
156 // blockdata, length
157 0x77, 0x2,
158 // 'ö'
159 0x02, 0x5b,
160 // object
161 0x73,
162 // class desc, "Serialize"
163 0x72, 0, 9, 'S', 'e', 'r', 'i', 'a', 'l', 'i', 'z', 'e',
164 // serialVersionUID
165 0, 0, 0, 0, 0, 0, 0, 1,
166 // flags (SC_SERIALIZABLE)
167 2,
168 // field count
169 0x0, 0x1,
170 // int dummy
171 'I', 0x0, 0x5, 'd', 'u', 'm', 'm', 'y',
172 // class annotation
173 0x78,
174 // super class desc
175 0x70,
176 // classdata[]

Callers

nothing calls this directly

Calls 15

writeBooleanMethod · 0.95
flushMethod · 0.95
writeByteMethod · 0.95
writeIntMethod · 0.95
writeUTFMethod · 0.95
writeCharMethod · 0.95
writeObjectMethod · 0.95
closeMethod · 0.95
toByteArrayMethod · 0.95
expectEqualMethod · 0.95
readBooleanMethod · 0.95
readByteMethod · 0.95

Tested by

no test coverage detected