use of com.hazelcast.nio.ObjectDataOutput in project hazelcast by hazelcast.
the class DataSerializableImplementsVersionedTest method isGetVersionCalledOnWrite.
private boolean isGetVersionCalledOnWrite(DataSerializable dataSerializable) throws IOException {
ObjectDataOutput out = getObjectDataOutput();
when(out.getVersion()).thenReturn(Versions.V4_0);
try {
dataSerializable.writeData(out);
} catch (NullPointerException | UnsupportedOperationException ignored) {
}
return isGetVersionCalled(out);
}
use of com.hazelcast.nio.ObjectDataOutput in project hazelcast by hazelcast.
the class SerializationV1Portable method writePortable.
@Override
public void writePortable(PortableWriter out) throws IOException {
out.writeByte("1", aByte);
out.writeBoolean("2", aBoolean);
out.writeChar("3", character);
out.writeShort("4", aShort);
out.writeInt("5", integer);
out.writeLong("6", aLong);
out.writeFloat("7", aFloat);
out.writeDouble("8", aDouble);
out.writeString("9", string);
out.writeByteArray("a1", bytes);
out.writeBooleanArray("a2", booleans);
out.writeCharArray("a3", chars);
out.writeShortArray("a4", shorts);
out.writeIntArray("a5", ints);
out.writeLongArray("a6", longs);
out.writeFloatArray("a7", floats);
out.writeDoubleArray("a8", doubles);
out.writeStringArray("a9", strings);
if (innerPortable == null) {
out.writeNullPortable("p", INNER_PORTABLE.getFactoryId(), INNER_PORTABLE.getClassId());
} else {
out.writePortable("p", innerPortable);
}
ObjectDataOutput rawDataOutput = out.getRawDataOutput();
boolean isNotNull = dataSerializable != null;
if (isNotNull) {
rawDataOutput.writeBoolean(isNotNull);
dataSerializable.writeData(rawDataOutput);
} else {
rawDataOutput.writeBoolean(isNotNull);
}
}
use of com.hazelcast.nio.ObjectDataOutput in project hazelcast by hazelcast.
the class ObjectCarryingPortable method writePortable.
@Override
public void writePortable(PortableWriter writer) throws IOException {
ObjectDataOutput output = writer.getRawDataOutput();
output.writeObject(object);
}
use of com.hazelcast.nio.ObjectDataOutput in project hazelcast by hazelcast.
the class RawDataPortable method writePortable.
@Override
public void writePortable(PortableWriter writer) throws IOException {
writer.writeLong("l", l);
writer.writeCharArray("c", c);
writer.writePortable("p", p);
final ObjectDataOutput output = writer.getRawDataOutput();
output.writeInt(k);
output.writeString(s);
output.writeObject(sds);
}
use of com.hazelcast.nio.ObjectDataOutput in project hazelcast by hazelcast.
the class APortable method writePortable.
public void writePortable(PortableWriter writer) throws IOException {
writer.writeBoolean("bool", bool);
writer.writeByte("b", b);
writer.writeChar("c", c);
writer.writeDouble("d", d);
writer.writeShort("s", s);
writer.writeFloat("f", f);
writer.writeInt("i", i);
writer.writeLong("l", l);
writer.writeString("str", str);
if (p != null) {
writer.writePortable("p", p);
} else {
writer.writeNullPortable("p", ReferenceObjects.PORTABLE_FACTORY_ID, ReferenceObjects.PORTABLE_CLASS_ID);
}
writer.writeBooleanArray("booleans", booleans);
writer.writeByteArray("bs", bytes);
writer.writeCharArray("cs", chars);
writer.writeDoubleArray("ds", doubles);
writer.writeShortArray("ss", shorts);
writer.writeFloatArray("fs", floats);
writer.writeIntArray("is", ints);
writer.writeLongArray("ls", longs);
writer.writeStringArray("strs", strings);
writer.writePortableArray("ps", portables);
writer.writeBooleanArray("booleansNull", booleansNull);
writer.writeByteArray("bsNull", bytesNull);
writer.writeCharArray("csNull", charsNull);
writer.writeDoubleArray("dsNull", doublesNull);
writer.writeShortArray("ssNull", shortsNull);
writer.writeFloatArray("fsNull", floatsNull);
writer.writeIntArray("isNull", intsNull);
writer.writeLongArray("lsNull", longsNull);
writer.writeStringArray("strsNull", stringsNull);
ObjectDataOutput dataOutput = writer.getRawDataOutput();
dataOutput.writeBoolean(bool);
dataOutput.writeByte(b);
dataOutput.writeChar(c);
dataOutput.writeDouble(d);
dataOutput.writeShort(s);
dataOutput.writeFloat(f);
dataOutput.writeInt(i);
dataOutput.writeLong(l);
dataOutput.writeString(str);
dataOutput.writeBooleanArray(booleans);
dataOutput.writeByteArray(bytes);
dataOutput.writeCharArray(chars);
dataOutput.writeDoubleArray(doubles);
dataOutput.writeShortArray(shorts);
dataOutput.writeFloatArray(floats);
dataOutput.writeIntArray(ints);
dataOutput.writeLongArray(longs);
dataOutput.writeUTFArray(strings);
dataOutput.writeBooleanArray(booleansNull);
dataOutput.writeByteArray(bytesNull);
dataOutput.writeCharArray(charsNull);
dataOutput.writeDoubleArray(doublesNull);
dataOutput.writeShortArray(shortsNull);
dataOutput.writeFloatArray(floatsNull);
dataOutput.writeIntArray(intsNull);
dataOutput.writeLongArray(longsNull);
dataOutput.writeUTFArray(stringsNull);
byteSize = (byte) bytes.length;
dataOutput.write(byteSize);
dataOutput.write(bytes);
dataOutput.write(bytes, 1, 2);
dataOutput.writeInt(str.length());
dataOutput.writeChars(str);
dataOutput.writeBytes(str);
dataOutput.writeByte(unsignedByte);
dataOutput.writeShort(unsignedShort);
dataOutput.writeObject(portableObject);
dataOutput.writeObject(identifiedDataSerializableObject);
dataOutput.writeObject(customByteArraySerializableObject);
dataOutput.writeObject(customStreamSerializableObject);
writeData(dataOutput, data);
}
Aggregations