@Override public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException { boolean hasIndexName = input.readBoolean(); if (hasIndexName) { indexName = input.readUTF(); } serializedModel = MarshallUtil.unmarshallByteArray(input); }
@Override public void readFrom(ObjectInput input) throws IOException { boolean hasIndexName = input.readBoolean(); if (hasIndexName) { indexName = input.readUTF(); } serializedModel = MarshallUtil.unmarshallByteArray(input); }
public static XidImpl readFrom(ObjectInput input) throws IOException { return new XidImpl(input.readInt(), MarshallUtil.unmarshallByteArray(input)); }
@Override public WrappedByteArray readObject(ObjectInput input) throws IOException { byte[] bytes = MarshallUtil.unmarshallByteArray(input); boolean hasHashCode = input.readBoolean(); if (hasHashCode) { return new WrappedByteArray(bytes, input.readInt()); } else { return new WrappedByteArray(bytes); } } }
public InitializerState readObjectVersion1(ObjectInput input) throws IOException { return new InitializerState( MarshallUtil.unmarshallString(input), input.readInt(), BitSet.valueOf(MarshallUtil.unmarshallByteArray(input)) ); }
@Test public void testByteArray() throws IOException, ClassNotFoundException { ObjectInputOutput io = new ObjectInputOutput(); MarshallUtil.marshallByteArray(null, io); Assert.assertNull(MarshallUtil.unmarshallByteArray(io)); Assert.assertEquals(0, io.buffer.size()); io.reset(); byte[] array = Util.EMPTY_BYTE_ARRAY; MarshallUtil.marshallByteArray(array, io); Assert.assertTrue(Arrays.equals(array, MarshallUtil.unmarshallByteArray(io))); Assert.assertEquals(0, io.buffer.size()); io.reset(); array = new byte[] {1, 2, 3}; MarshallUtil.marshallByteArray(array, io); Assert.assertTrue(Arrays.equals(array, MarshallUtil.unmarshallByteArray(io))); Assert.assertEquals(0, io.buffer.size()); io.reset(); }