use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getInt32.
@Override
public int getInt32(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case INT32:
try {
return in.readInt(readFixedSizePosition(fd));
} catch (IOException e) {
throw illegalStateException(e);
}
case NULLABLE_INT32:
return getVariableSizeAsNonNull(fd, ObjectDataInput::readInt, "Int32");
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getInt8.
@Override
public byte getInt8(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case INT8:
try {
return in.readByte(readFixedSizePosition(fd));
} catch (IOException e) {
throw illegalStateException(e);
}
case NULLABLE_INT8:
return getVariableSizeAsNonNull(fd, ObjectDataInput::readByte, "Int8");
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class DataSerializableImplementsVersionedTest method isGetVersionCalledOnRead.
private boolean isGetVersionCalledOnRead(DataSerializable dataSerializable) throws IOException {
ObjectDataInput in = getObjectDataInput();
when(in.getVersion()).thenReturn(Versions.V4_0);
try {
dataSerializable.readData(in);
} catch (NullPointerException | UnsupportedOperationException | IllegalArgumentException | ArithmeticException ignored) {
}
return isGetVersionCalled(in);
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class DataSerializableImplementsVersionedTest method getObjectDataInput.
// overridden in EE
protected ObjectDataInput getObjectDataInput() {
ObjectDataInput input = mock(ObjectDataInput.class, withSettings().extraInterfaces(SerializationServiceSupport.class, DataReader.class));
when(((SerializationServiceSupport) input).getSerializationService()).thenReturn(serializationService);
return input;
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class AbstractDataStreamIntegrationTest method testByteArray.
@Test
public void testByteArray() throws IOException {
byte[] arr = new byte[] { Byte.MIN_VALUE, Byte.MAX_VALUE, 0 };
out.writeByteArray(arr);
ObjectDataInput in = getDataInputFromOutput();
assertArrayEquals(arr, in.readByteArray());
}
Aggregations