39 |
|
|
40 |
package java.io; |
package java.io; |
41 |
|
|
|
import gnu.classpath.Configuration; |
|
42 |
import gnu.java.io.ObjectIdentityWrapper; |
import gnu.java.io.ObjectIdentityWrapper; |
43 |
import gnu.java.lang.reflect.TypeSignature; |
import gnu.java.lang.reflect.TypeSignature; |
44 |
import gnu.java.security.action.SetAccessibleAction; |
import gnu.java.security.action.SetAccessibleAction; |
417 |
|
|
418 |
protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException |
protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException |
419 |
{ |
{ |
420 |
realOutput.writeByte(TC_CLASSDESC); |
if (osc.isProxyClass) |
|
realOutput.writeUTF(osc.getName()); |
|
|
realOutput.writeLong(osc.getSerialVersionUID()); |
|
|
assignNewHandle(osc); |
|
|
|
|
|
int flags = osc.getFlags(); |
|
|
|
|
|
if (protocolVersion == PROTOCOL_VERSION_2 |
|
|
&& osc.isExternalizable()) |
|
|
flags |= SC_BLOCK_DATA; |
|
|
|
|
|
realOutput.writeByte(flags); |
|
|
|
|
|
ObjectStreamField[] fields = osc.fields; |
|
|
realOutput.writeShort(fields.length); |
|
|
|
|
|
ObjectStreamField field; |
|
|
for (int i = 0; i < fields.length; i++) |
|
421 |
{ |
{ |
422 |
field = fields[i]; |
realOutput.writeByte(TC_PROXYCLASSDESC); |
423 |
realOutput.writeByte(field.getTypeCode ()); |
Class[] intfs = osc.forClass().getInterfaces(); |
424 |
realOutput.writeUTF(field.getName ()); |
realOutput.writeInt(intfs.length); |
425 |
|
for (int i = 0; i < intfs.length; i++) |
426 |
if (! field.isPrimitive()) |
realOutput.writeUTF(intfs[i].getName()); |
427 |
writeObject(field.getTypeString()); |
|
428 |
|
boolean oldmode = setBlockDataMode(true); |
429 |
|
annotateProxyClass(osc.forClass()); |
430 |
|
setBlockDataMode(oldmode); |
431 |
|
realOutput.writeByte(TC_ENDBLOCKDATA); |
432 |
|
} |
433 |
|
else |
434 |
|
{ |
435 |
|
realOutput.writeByte(TC_CLASSDESC); |
436 |
|
realOutput.writeUTF(osc.getName()); |
437 |
|
realOutput.writeLong(osc.getSerialVersionUID()); |
438 |
|
assignNewHandle(osc); |
439 |
|
|
440 |
|
int flags = osc.getFlags(); |
441 |
|
|
442 |
|
if (protocolVersion == PROTOCOL_VERSION_2 |
443 |
|
&& osc.isExternalizable()) |
444 |
|
flags |= SC_BLOCK_DATA; |
445 |
|
|
446 |
|
realOutput.writeByte(flags); |
447 |
|
|
448 |
|
ObjectStreamField[] fields = osc.fields; |
449 |
|
realOutput.writeShort(fields.length); |
450 |
|
|
451 |
|
ObjectStreamField field; |
452 |
|
for (int i = 0; i < fields.length; i++) |
453 |
|
{ |
454 |
|
field = fields[i]; |
455 |
|
realOutput.writeByte(field.getTypeCode ()); |
456 |
|
realOutput.writeUTF(field.getName ()); |
457 |
|
|
458 |
|
if (! field.isPrimitive()) |
459 |
|
writeObject(field.getTypeString()); |
460 |
|
} |
461 |
|
|
462 |
|
boolean oldmode = setBlockDataMode(true); |
463 |
|
annotateClass(osc.forClass()); |
464 |
|
setBlockDataMode(oldmode); |
465 |
|
realOutput.writeByte(TC_ENDBLOCKDATA); |
466 |
} |
} |
|
|
|
|
boolean oldmode = setBlockDataMode(true); |
|
|
annotateClass(osc.forClass()); |
|
|
setBlockDataMode(oldmode); |
|
|
realOutput.writeByte(TC_ENDBLOCKDATA); |
|
467 |
|
|
468 |
if (osc.isSerializable() || osc.isExternalizable()) |
if (osc.isSerializable() || osc.isExternalizable()) |
469 |
writeObject(osc.getSuper()); |
writeObject(osc.getSuper()); |
1588 |
private boolean dump = false; |
private boolean dump = false; |
1589 |
|
|
1590 |
private static final boolean DEBUG = false; |
private static final boolean DEBUG = false; |
|
|
|
|
static |
|
|
{ |
|
|
if (Configuration.INIT_LOAD_LIBRARY) |
|
|
{ |
|
|
System.loadLibrary("javaio"); |
|
|
} |
|
|
} |
|
1591 |
} |
} |