use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class ObjectCarryingPortable method readPortable.
@Override
public void readPortable(PortableReader reader) throws IOException {
ObjectDataInput input = reader.getRawDataInput();
object = input.readObject();
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class SerializationServiceV1 method initDataSerializableInputAndSkipTheHeader.
/**
* Init the ObjectDataInput for the given Data skipping the serialization header-bytes and navigating to the position
* from where the readData() starts reading the object fields.
*
* @param data data to initialize the ObjectDataInput with.
* @return the initialized ObjectDataInput without the header.
* @throws IOException
*/
public ObjectDataInput initDataSerializableInputAndSkipTheHeader(Data data) throws IOException {
ObjectDataInput input = createObjectDataInput(data);
byte header = input.readByte();
if (isFlagSet(header, IDS_FLAG)) {
skipBytesSafely(input, FACTORY_AND_CLASS_ID_BYTE_LENGTH);
} else {
input.readString();
}
if (isFlagSet(header, EE_FLAG)) {
skipBytesSafely(input, EE_BYTE_LENGTH);
}
return input;
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getArrayOfBoolean.
@Override
@Nullable
public boolean[] getArrayOfBoolean(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case ARRAY_OF_BOOLEAN:
return getVariableSize(fd, CompactInternalGenericRecord::readBooleanBits);
case ARRAY_OF_NULLABLE_BOOLEAN:
return getNullableArrayAsPrimitiveArray(fd, ObjectDataInput::readBooleanArray, "Boolean");
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getNullableFloat64.
@Nullable
@Override
public Double getNullableFloat64(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case FLOAT64:
try {
return in.readDouble(readFixedSizePosition(fd));
} catch (IOException e) {
throw illegalStateException(e);
}
case NULLABLE_FLOAT64:
return getVariableSize(fd, ObjectDataInput::readDouble);
default:
throw unexpectedFieldKind(fieldKind, fieldName);
}
}
use of com.hazelcast.nio.ObjectDataInput in project hazelcast by hazelcast.
the class CompactInternalGenericRecord method getBoolean.
@Override
public boolean getBoolean(@Nonnull String fieldName) {
FieldDescriptor fd = getFieldDefinition(fieldName);
FieldKind fieldKind = fd.getKind();
switch(fieldKind) {
case BOOLEAN:
return getBoolean(fd);
case NULLABLE_BOOLEAN:
return getVariableSizeAsNonNull(fd, ObjectDataInput::readBoolean, "Boolean");
default:
throw unexpectedFieldKind(BOOLEAN, fieldName);
}
}
Aggregations