@Override public ObjectDataOutput getRawDataOutput() throws IOException { if (!raw) { int pos = out.position(); // last index int index = cd.getFieldCount(); out.writeInt(offset + index * INT_SIZE_IN_BYTES, pos); } raw = true; return out; }
@Override public ObjectDataInput getRawDataInput() throws IOException { if (!raw) { int pos = in.readInt(offset + cd.getFieldCount() * Bits.INT_SIZE_IN_BYTES); in.position(pos); } raw = true; return in; }
@Override public ObjectDataOutput getRawDataOutput() throws IOException { if (!raw) { int pos = out.position(); // last index int index = cd.getFieldCount(); out.writeInt(offset + index * INT_SIZE_IN_BYTES, pos); } raw = true; return out; }
DefaultPortableWriter(PortableSerializer serializer, BufferObjectDataOutput out, ClassDefinition cd) throws IOException { this.serializer = serializer; this.out = out; this.cd = cd; this.writtenFields = createHashSet(cd.getFieldCount()); this.begin = out.position(); // room for final offset out.writeZeroBytes(4); out.writeInt(cd.getFieldCount()); this.offset = out.position(); // one additional for raw data int fieldIndexesLength = (cd.getFieldCount() + 1) * INT_SIZE_IN_BYTES; out.writeZeroBytes(fieldIndexesLength); }
@Override public ObjectDataInput getRawDataInput() throws IOException { if (!raw) { int pos = in.readInt(offset + cd.getFieldCount() * Bits.INT_SIZE_IN_BYTES); in.position(pos); } raw = true; return in; }
DefaultPortableWriter(PortableSerializer serializer, BufferObjectDataOutput out, ClassDefinition cd) throws IOException { this.serializer = serializer; this.out = out; this.cd = cd; this.writtenFields = createHashSet(cd.getFieldCount()); this.begin = out.position(); // room for final offset out.writeZeroBytes(4); out.writeInt(cd.getFieldCount()); this.offset = out.position(); // one additional for raw data int fieldIndexesLength = (cd.getFieldCount() + 1) * INT_SIZE_IN_BYTES; out.writeZeroBytes(fieldIndexesLength); }
/** * Initialises the finalPosition and offset and validates the fieldCount against the given class definition */ private void initFinalPositionAndOffset(BufferObjectDataInput in, ClassDefinition cd) { int fieldCount; try { // final position after portable is read finalPosition = in.readInt(); fieldCount = in.readInt(); } catch (IOException e) { throw new HazelcastSerializationException(e); } if (fieldCount != cd.getFieldCount()) { throw new IllegalStateException("Field count[" + fieldCount + "] in stream does not match " + cd); } offset = in.position(); }
/** * Initialises the finalPosition and offset and validates the fieldCount against the given class definition */ private void initFinalPositionAndOffset(BufferObjectDataInput in, ClassDefinition cd) { int fieldCount; try { // final position after portable is read finalPosition = in.readInt(); fieldCount = in.readInt(); } catch (IOException e) { throw new HazelcastSerializationException(e); } if (fieldCount != cd.getFieldCount()) { throw new IllegalStateException("Field count[" + fieldCount + "] in stream does not match " + cd); } offset = in.position(); }