protected void tightMarshalCachedObject2( OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, BooleanStream bs) throws IOException { if (wireFormat.isCacheEnabled()) { Short index = wireFormat.getMarshallCacheIndex(o); if (bs.readBoolean()) { dataOut.writeShort(index.shortValue()); wireFormat.tightMarshalNestedObject2(o, dataOut, bs); } else { dataOut.writeShort(index.shortValue()); } } else { wireFormat.tightMarshalNestedObject2(o, dataOut, bs); } }
protected void looseMarshalCachedObject( OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) throws IOException { if (wireFormat.isCacheEnabled()) { Short index = wireFormat.getMarshallCacheIndex(o); dataOut.writeBoolean(index == null); if (index == null) { index = wireFormat.addToMarshallCache(o); dataOut.writeShort(index.shortValue()); wireFormat.looseMarshalNestedObject(o, dataOut); } else { dataOut.writeShort(index.shortValue()); } } else { wireFormat.looseMarshalNestedObject(o, dataOut); } }
protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn) throws IOException { if (wireFormat.isCacheEnabled()) { if (dataIn.readBoolean()) { short index = dataIn.readShort(); DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn); wireFormat.setInUnmarshallCache(index, object); return object; } else { short index = dataIn.readShort(); return wireFormat.getFromUnmarshallCache(index); } } else { return wireFormat.looseUnmarshalNestedObject(dataIn); } }
protected int tightMarshalCachedObject1( OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) throws IOException { if (wireFormat.isCacheEnabled()) { Short index = wireFormat.getMarshallCacheIndex(o); bs.writeBoolean(index == null); if (index == null) { int rc = wireFormat.tightMarshalNestedObject1(o, bs); wireFormat.addToMarshallCache(o); return 2 + rc; } else { return 2; } } else { return wireFormat.tightMarshalNestedObject1(o, bs); } }