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

Method classDesc

classpath/java/io/ObjectOutputStream.java:196–229  ·  view source on GitHub ↗
(Class clazz, int scFlags)

Source from the content-addressed store, hash-verified

194 }
195
196 private void classDesc(Class clazz, int scFlags) throws IOException {
197 rawByte(TC_CLASSDESC);
198
199 // class name
200 string(clazz.getName());
201
202 // serial version UID
203 long serialVersionUID = 1l;
204 try {
205 Field field = clazz.getField("serialVersionUID");
206 serialVersionUID = field.getLong(null);
207 } catch (Exception ignored) {}
208 rawLong(serialVersionUID);
209
210 // handle
211 rawByte(SC_SERIALIZABLE | scFlags);
212
213 Field[] fields = getFields(clazz);
214 rawShort(fields.length);
215 for (Field field : fields) {
216 Class fieldType = field.getType();
217 if (fieldType.isPrimitive()) {
218 rawByte(primitiveTypeChar(fieldType));
219 string(field.getName());
220 } else {
221 rawByte(fieldType.isArray() ? '[' : 'L');
222 string(field.getName());
223 rawByte(TC_STRING);
224 string("L" + fieldType.getName().replace('.', '/') + ";");
225 }
226 }
227 rawByte(TC_ENDBLOCKDATA); // TODO: write annotation
228 rawByte(TC_NULL); // super class desc
229 }
230
231 private void field(Object o, Field field) throws IOException {
232 try {

Callers 1

writeObjectMethod · 0.95

Calls 15

rawByteMethod · 0.95
stringMethod · 0.95
getLongMethod · 0.95
rawLongMethod · 0.95
getFieldsMethod · 0.95
rawShortMethod · 0.95
getTypeMethod · 0.95
isPrimitiveMethod · 0.95
primitiveTypeCharMethod · 0.95
getNameMethod · 0.95
isArrayMethod · 0.95
getNameMethod · 0.95

Tested by

no test coverage detected