Class BinaryWriterExImpl
- java.lang.Object
-
- org.apache.ignite.internal.binary.BinaryWriterExImpl
-
- All Implemented Interfaces:
DataOutput,ObjectOutput,AutoCloseable,BinaryRawWriter,BinaryWriter,BinaryRawWriterEx
public class BinaryWriterExImpl extends Object implements BinaryWriter, BinaryRawWriterEx, ObjectOutput
Binary writer implementation.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BUFFER_SIZEDefault buffer size for reading from streams.
-
Constructor Summary
Constructors Constructor Description BinaryWriterExImpl(BinaryContext ctx)BinaryWriterExImpl(BinaryContext ctx, BinaryThreadLocalContext tlsCtx)BinaryWriterExImpl(BinaryContext ctx, BinaryOutputStream out, BinaryWriterSchemaHolder schema, BinaryWriterHandles handles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]array()voidclose()Close the writer releasing resources if necessary.BinaryContextcontext()BinarySchemacurrentSchema()voiddoWriteBinaryObject(@Nullable BinaryObjectImpl po)voiddoWriteDate(@Nullable Date date)voiddoWriteDecimal(@Nullable BigDecimal val)voiddoWriteObject(@Nullable Object obj)Write object.voiddoWriteProxy(Proxy proxy, Class<?>[] intfs)voiddoWriteString(@Nullable String val)voiddoWriteTime(@Nullable Time time)voiddoWriteTimestamp(@Nullable Timestamp ts)voiddoWriteUuid(@Nullable UUID uuid)booleanfailIfUnregistered()voidfailIfUnregistered(boolean failIfUnregistered)voidflush()BinaryWriterExImplnewWriter(int typeId)Create new writer with same context.BinaryOutputStreamout()voidpopSchema()Pop schema.voidpostWrite(boolean userType, boolean registered)Perform post-write.voidpostWriteHashCode(@Nullable String clsName)Perform post-write hash code update if necessary.voidpreWrite(@Nullable String clsName)Perform pre-write.BinaryRawWriterrawWriter()Gets raw writer.intreserveInt()Reserve a room for an integer.intschemaId()voidschemaId(int schemaId)voidtypeId(int typeId)voidwrite(byte[] val)voidwrite(byte[] val, int off, int len)voidwrite(int b)voidwriteBoolean(boolean val)voidwriteBoolean(String fieldName, boolean val)voidwriteBooleanArray(@org.jetbrains.annotations.Nullable boolean[] val)voidwriteBooleanArray(String fieldName, @org.jetbrains.annotations.Nullable boolean[] val)voidwriteBooleanFieldPrimitive(boolean val)voidwriteByte(byte val)voidwriteByte(int v)voidwriteByte(String fieldName, byte val)voidwriteByteArray(@org.jetbrains.annotations.Nullable byte[] val)intwriteByteArray(InputStream in, int limit)Write byte array from the InputStream.voidwriteByteArray(String fieldName, @org.jetbrains.annotations.Nullable byte[] val)voidwriteByteFieldPrimitive(byte val)voidwriteBytes(String s)voidwriteChar(char val)voidwriteChar(int v)voidwriteChar(String fieldName, char val)voidwriteCharArray(@org.jetbrains.annotations.Nullable char[] val)voidwriteCharArray(String fieldName, @org.jetbrains.annotations.Nullable char[] val)voidwriteCharFieldPrimitive(char val)voidwriteChars(String s)<T> voidwriteCollection(@Nullable Collection<T> col)<T> voidwriteCollection(String fieldName, @Nullable Collection<T> col)voidwriteDate(@Nullable Date val)voidwriteDate(String fieldName, @Nullable Date val)voidwriteDateArray(@Nullable Date[] val)voidwriteDateArray(String fieldName, @Nullable Date[] val)voidwriteDecimal(@Nullable BigDecimal val)voidwriteDecimal(String fieldName, @Nullable BigDecimal val)voidwriteDecimalArray(@Nullable BigDecimal[] val)voidwriteDecimalArray(String fieldName, @Nullable BigDecimal[] val)voidwriteDouble(double val)voidwriteDouble(String fieldName, double val)voidwriteDoubleArray(@org.jetbrains.annotations.Nullable double[] val)voidwriteDoubleArray(String fieldName, @org.jetbrains.annotations.Nullable double[] val)voidwriteDoubleFieldPrimitive(double val)<T extends Enum<?>>
voidwriteEnum(String fieldName, T val)<T extends Enum<?>>
voidwriteEnum(T val)<T extends Enum<?>>
voidwriteEnumArray(String fieldName, T[] val)<T extends Enum<?>>
voidwriteEnumArray(T[] val)voidwriteFieldId(int fieldId)Write field ID.voidwriteFieldIdNoSchemaUpdate(int fieldId)Write field ID without schema ID update.voidwriteFloat(float val)voidwriteFloat(String fieldName, float val)voidwriteFloatArray(@org.jetbrains.annotations.Nullable float[] val)voidwriteFloatArray(String fieldName, @org.jetbrains.annotations.Nullable float[] val)voidwriteFloatFieldPrimitive(float val)voidwriteInt(int val)voidwriteInt(int pos, int val)Write int value at the specific position.voidwriteInt(String fieldName, int val)voidwriteIntArray(@org.jetbrains.annotations.Nullable int[] val)voidwriteIntArray(String fieldName, @org.jetbrains.annotations.Nullable int[] val)voidwriteIntFieldPrimitive(int val)voidwriteLong(long val)voidwriteLong(String fieldName, long val)voidwriteLongArray(@org.jetbrains.annotations.Nullable long[] val)voidwriteLongArray(String fieldName, @org.jetbrains.annotations.Nullable long[] val)voidwriteLongFieldPrimitive(long val)<K,V>
voidwriteMap(@Nullable Map<K,V> map)<K,V>
voidwriteMap(String fieldName, @Nullable Map<K,V> map)voidwriteObject(@Nullable Object obj)voidwriteObject(String fieldName, @Nullable Object obj)voidwriteObjectArray(@Nullable Object[] val)voidwriteObjectArray(String fieldName, @Nullable Object[] val)voidwriteObjectDetached(@Nullable Object obj)voidwriteShort(int v)voidwriteShort(short val)voidwriteShort(String fieldName, short val)voidwriteShortArray(@org.jetbrains.annotations.Nullable short[] val)voidwriteShortArray(String fieldName, @org.jetbrains.annotations.Nullable short[] val)voidwriteShortFieldPrimitive(short val)voidwriteString(@Nullable String val)voidwriteString(String fieldName, @Nullable String val)voidwriteStringArray(@Nullable String[] val)voidwriteStringArray(String fieldName, @Nullable String[] val)voidwriteTime(@Nullable Time val)voidwriteTime(String fieldName, @Nullable Time val)voidwriteTimeArray(@Nullable Time[] val)voidwriteTimeArray(String fieldName, @Nullable Time[] val)voidwriteTimestamp(@Nullable Timestamp val)voidwriteTimestamp(String fieldName, @Nullable Timestamp val)voidwriteTimestampArray(@Nullable Timestamp[] val)voidwriteTimestampArray(String fieldName, @Nullable Timestamp[] val)voidwriteUTF(String s)voidwriteUuid(@Nullable UUID val)voidwriteUuid(String fieldName, @Nullable UUID val)voidwriteUuidArray(@Nullable UUID[] val)voidwriteUuidArray(String fieldName, @Nullable UUID[] val)
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
Default buffer size for reading from streams.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinaryWriterExImpl
public BinaryWriterExImpl(BinaryContext ctx)
- Parameters:
ctx- Context.
-
BinaryWriterExImpl
public BinaryWriterExImpl(BinaryContext ctx, BinaryThreadLocalContext tlsCtx)
- Parameters:
ctx- Context.tlsCtx- TLS context.
-
BinaryWriterExImpl
public BinaryWriterExImpl(BinaryContext ctx, BinaryOutputStream out, BinaryWriterSchemaHolder schema, BinaryWriterHandles handles)
- Parameters:
ctx- Context.out- Output stream.handles- Handles.
-
-
Method Detail
-
failIfUnregistered
public boolean failIfUnregistered()
- Returns:
- Fail if unregistered flag value.
-
failIfUnregistered
public void failIfUnregistered(boolean failIfUnregistered)
- Parameters:
failIfUnregistered- Fail if unregistered.
-
typeId
public void typeId(int typeId)
- Parameters:
typeId- Type ID.
-
close
public void close()
Close the writer releasing resources if necessary.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBinaryRawWriterEx- Specified by:
closein interfaceObjectOutput
-
array
public byte[] array()
- Returns:
- Array.
-
preWrite
public void preWrite(@Nullable @Nullable String clsName)Perform pre-write. Reserves space for header and writes class name if needed.- Parameters:
clsName- Class name (optional).
-
postWrite
public void postWrite(boolean userType, boolean registered)Perform post-write. Fills object header.- Parameters:
userType- User type flag.registered- Whether type is registered.
-
postWriteHashCode
public void postWriteHashCode(@Nullable @Nullable String clsName)Perform post-write hash code update if necessary.- Parameters:
clsName- Class name. Always null if class is registered.
-
popSchema
public void popSchema()
Pop schema.
-
write
public void write(byte[] val)
- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Parameters:
val- Byte array.
-
write
public void write(byte[] val, int off, int len)- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Parameters:
val- Byte array.off- Offset.len- Length.
-
doWriteDecimal
public void doWriteDecimal(@Nullable @Nullable BigDecimal val)- Parameters:
val- String value.
-
doWriteString
public void doWriteString(@Nullable @Nullable String val)- Parameters:
val- String value.
-
doWriteUuid
public void doWriteUuid(@Nullable @Nullable UUID uuid)- Parameters:
uuid- UUID.
-
doWriteDate
public void doWriteDate(@Nullable @Nullable Date date)- Parameters:
date- Date.
-
doWriteTimestamp
public void doWriteTimestamp(@Nullable @Nullable Timestamp ts)- Parameters:
ts- Timestamp.
-
doWriteTime
public void doWriteTime(@Nullable @Nullable Time time)- Parameters:
time- Time.
-
doWriteObject
public void doWriteObject(@Nullable @Nullable Object obj) throws BinaryObjectExceptionWrite object.- Parameters:
obj- Object.- Throws:
BinaryObjectException- In case of error.
-
doWriteBinaryObject
public void doWriteBinaryObject(@Nullable @Nullable BinaryObjectImpl po)- Parameters:
po- Binary object.
-
writeByteFieldPrimitive
public void writeByteFieldPrimitive(byte val)
- Parameters:
val- Value.
-
writeShortFieldPrimitive
public void writeShortFieldPrimitive(short val)
- Parameters:
val- Value.
-
writeIntFieldPrimitive
public void writeIntFieldPrimitive(int val)
- Parameters:
val- Value.
-
writeLongFieldPrimitive
public void writeLongFieldPrimitive(long val)
- Parameters:
val- Value.
-
writeFloatFieldPrimitive
public void writeFloatFieldPrimitive(float val)
- Parameters:
val- Value.
-
writeDoubleFieldPrimitive
public void writeDoubleFieldPrimitive(double val)
- Parameters:
val- Value.
-
writeCharFieldPrimitive
public void writeCharFieldPrimitive(char val)
- Parameters:
val- Value.
-
writeBooleanFieldPrimitive
public void writeBooleanFieldPrimitive(boolean val)
- Parameters:
val- Value.
-
writeByte
public void writeByte(String fieldName, byte val) throws BinaryObjectException
- Specified by:
writeBytein interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeByte
public void writeByte(byte val) throws BinaryObjectException- Specified by:
writeBytein interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeShort
public void writeShort(String fieldName, short val) throws BinaryObjectException
- Specified by:
writeShortin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeShort
public void writeShort(short val) throws BinaryObjectException- Specified by:
writeShortin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeInt
public void writeInt(String fieldName, int val) throws BinaryObjectException
- Specified by:
writeIntin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeInt
public void writeInt(int val) throws BinaryObjectException- Specified by:
writeIntin interfaceBinaryRawWriter- Specified by:
writeIntin interfaceDataOutput- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeLong
public void writeLong(String fieldName, long val) throws BinaryObjectException
- Specified by:
writeLongin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeLong
public void writeLong(long val) throws BinaryObjectException- Specified by:
writeLongin interfaceBinaryRawWriter- Specified by:
writeLongin interfaceDataOutput- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeFloat
public void writeFloat(String fieldName, float val) throws BinaryObjectException
- Specified by:
writeFloatin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeFloat
public void writeFloat(float val) throws BinaryObjectException- Specified by:
writeFloatin interfaceBinaryRawWriter- Specified by:
writeFloatin interfaceDataOutput- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDouble
public void writeDouble(String fieldName, double val) throws BinaryObjectException
- Specified by:
writeDoublein interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDouble
public void writeDouble(double val) throws BinaryObjectException- Specified by:
writeDoublein interfaceBinaryRawWriter- Specified by:
writeDoublein interfaceDataOutput- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeChar
public void writeChar(String fieldName, char val) throws BinaryObjectException
- Specified by:
writeCharin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeChar
public void writeChar(char val) throws BinaryObjectException- Specified by:
writeCharin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeBoolean
public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException
- Specified by:
writeBooleanin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeBoolean
public void writeBoolean(boolean val) throws BinaryObjectException- Specified by:
writeBooleanin interfaceBinaryRawWriter- Specified by:
writeBooleanin interfaceDataOutput- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDecimal
public void writeDecimal(String fieldName, @Nullable @Nullable BigDecimal val) throws BinaryObjectException
- Specified by:
writeDecimalin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDecimal
public void writeDecimal(@Nullable @Nullable BigDecimal val) throws BinaryObjectException- Specified by:
writeDecimalin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeString
public void writeString(String fieldName, @Nullable @Nullable String val) throws BinaryObjectException
- Specified by:
writeStringin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeString
public void writeString(@Nullable @Nullable String val) throws BinaryObjectException- Specified by:
writeStringin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeUuid
public void writeUuid(String fieldName, @Nullable @Nullable UUID val) throws BinaryObjectException
- Specified by:
writeUuidin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- UUID to write.- Throws:
BinaryObjectException- In case of error.
-
writeUuid
public void writeUuid(@Nullable @Nullable UUID val) throws BinaryObjectException- Specified by:
writeUuidin interfaceBinaryRawWriter- Parameters:
val- UUID to write.- Throws:
BinaryObjectException- In case of error.
-
writeDate
public void writeDate(String fieldName, @Nullable @Nullable Date val) throws BinaryObjectException
- Specified by:
writeDatein interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Date to write.- Throws:
BinaryObjectException- In case of error.
-
writeDate
public void writeDate(@Nullable @Nullable Date val) throws BinaryObjectException- Specified by:
writeDatein interfaceBinaryRawWriter- Parameters:
val- Date to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimestamp
public void writeTimestamp(String fieldName, @Nullable @Nullable Timestamp val) throws BinaryObjectException
- Specified by:
writeTimestampin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Timestamp to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimestamp
public void writeTimestamp(@Nullable @Nullable Timestamp val) throws BinaryObjectException- Specified by:
writeTimestampin interfaceBinaryRawWriter- Parameters:
val- Timestamp to write.- Throws:
BinaryObjectException- In case of error.
-
writeTime
public void writeTime(String fieldName, @Nullable @Nullable Time val) throws BinaryObjectException
- Specified by:
writeTimein interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Time to write.- Throws:
BinaryObjectException- In case of error.
-
writeTime
public void writeTime(@Nullable @Nullable Time val) throws BinaryObjectException- Specified by:
writeTimein interfaceBinaryRawWriter- Parameters:
val- Time to write.- Throws:
BinaryObjectException- In case of error.
-
writeObject
public void writeObject(String fieldName, @Nullable @Nullable Object obj) throws BinaryObjectException
- Specified by:
writeObjectin interfaceBinaryWriter- Parameters:
fieldName- Field name.obj- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeObject
public void writeObject(@Nullable @Nullable Object obj) throws BinaryObjectException- Specified by:
writeObjectin interfaceBinaryRawWriter- Specified by:
writeObjectin interfaceObjectOutput- Parameters:
obj- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeObjectDetached
public void writeObjectDetached(@Nullable @Nullable Object obj) throws BinaryObjectException- Specified by:
writeObjectDetachedin interfaceBinaryRawWriterEx- Parameters:
obj- Object to write.- Throws:
BinaryObjectException- In case of error.
-
writeByteArray
public void writeByteArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable byte[] val) throws BinaryObjectException
- Specified by:
writeByteArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeByteArray
public void writeByteArray(@Nullable @org.jetbrains.annotations.Nullable byte[] val) throws BinaryObjectException- Specified by:
writeByteArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeShortArray
public void writeShortArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable short[] val) throws BinaryObjectException
- Specified by:
writeShortArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeShortArray
public void writeShortArray(@Nullable @org.jetbrains.annotations.Nullable short[] val) throws BinaryObjectException- Specified by:
writeShortArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeIntArray
public void writeIntArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable int[] val) throws BinaryObjectException
- Specified by:
writeIntArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeIntArray
public void writeIntArray(@Nullable @org.jetbrains.annotations.Nullable int[] val) throws BinaryObjectException- Specified by:
writeIntArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeLongArray
public void writeLongArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable long[] val) throws BinaryObjectException
- Specified by:
writeLongArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeLongArray
public void writeLongArray(@Nullable @org.jetbrains.annotations.Nullable long[] val) throws BinaryObjectException- Specified by:
writeLongArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeFloatArray
public void writeFloatArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable float[] val) throws BinaryObjectException
- Specified by:
writeFloatArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeFloatArray
public void writeFloatArray(@Nullable @org.jetbrains.annotations.Nullable float[] val) throws BinaryObjectException- Specified by:
writeFloatArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDoubleArray
public void writeDoubleArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable double[] val) throws BinaryObjectException
- Specified by:
writeDoubleArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDoubleArray
public void writeDoubleArray(@Nullable @org.jetbrains.annotations.Nullable double[] val) throws BinaryObjectException- Specified by:
writeDoubleArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeCharArray
public void writeCharArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable char[] val) throws BinaryObjectException
- Specified by:
writeCharArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeCharArray
public void writeCharArray(@Nullable @org.jetbrains.annotations.Nullable char[] val) throws BinaryObjectException- Specified by:
writeCharArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeBooleanArray
public void writeBooleanArray(String fieldName, @Nullable @org.jetbrains.annotations.Nullable boolean[] val) throws BinaryObjectException
- Specified by:
writeBooleanArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeBooleanArray
public void writeBooleanArray(@Nullable @org.jetbrains.annotations.Nullable boolean[] val) throws BinaryObjectException- Specified by:
writeBooleanArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDecimalArray
public void writeDecimalArray(String fieldName, @Nullable @Nullable BigDecimal[] val) throws BinaryObjectException
- Specified by:
writeDecimalArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDecimalArray
public void writeDecimalArray(@Nullable @Nullable BigDecimal[] val) throws BinaryObjectException- Specified by:
writeDecimalArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeStringArray
public void writeStringArray(String fieldName, @Nullable @Nullable String[] val) throws BinaryObjectException
- Specified by:
writeStringArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeStringArray
public void writeStringArray(@Nullable @Nullable String[] val) throws BinaryObjectException- Specified by:
writeStringArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeUuidArray
public void writeUuidArray(String fieldName, @Nullable @Nullable UUID[] val) throws BinaryObjectException
- Specified by:
writeUuidArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeUuidArray
public void writeUuidArray(@Nullable @Nullable UUID[] val) throws BinaryObjectException- Specified by:
writeUuidArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDateArray
public void writeDateArray(String fieldName, @Nullable @Nullable Date[] val) throws BinaryObjectException
- Specified by:
writeDateArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeDateArray
public void writeDateArray(@Nullable @Nullable Date[] val) throws BinaryObjectException- Specified by:
writeDateArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimestampArray
public void writeTimestampArray(String fieldName, @Nullable @Nullable Timestamp[] val) throws BinaryObjectException
- Specified by:
writeTimestampArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimestampArray
public void writeTimestampArray(@Nullable @Nullable Timestamp[] val) throws BinaryObjectException- Specified by:
writeTimestampArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimeArray
public void writeTimeArray(String fieldName, @Nullable @Nullable Time[] val) throws BinaryObjectException
- Specified by:
writeTimeArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeTimeArray
public void writeTimeArray(@Nullable @Nullable Time[] val) throws BinaryObjectException- Specified by:
writeTimeArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeObjectArray
public void writeObjectArray(String fieldName, @Nullable @Nullable Object[] val) throws BinaryObjectException
- Specified by:
writeObjectArrayin interfaceBinaryWriter- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeObjectArray
public void writeObjectArray(@Nullable @Nullable Object[] val) throws BinaryObjectException- Specified by:
writeObjectArrayin interfaceBinaryRawWriter- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeCollection
public <T> void writeCollection(String fieldName, @Nullable @Nullable Collection<T> col) throws BinaryObjectException
- Specified by:
writeCollectionin interfaceBinaryWriter- Type Parameters:
T- Type of elements in collection to write.- Parameters:
fieldName- Field name.col- Collection to write.- Throws:
BinaryObjectException- In case of error.
-
writeCollection
public <T> void writeCollection(@Nullable @Nullable Collection<T> col) throws BinaryObjectException- Specified by:
writeCollectionin interfaceBinaryRawWriter- Type Parameters:
T- Type of elements in collection to write.- Parameters:
col- Collection to write.- Throws:
BinaryObjectException- In case of error.
-
writeMap
public <K,V> void writeMap(String fieldName, @Nullable @Nullable Map<K,V> map) throws BinaryObjectException
- Specified by:
writeMapin interfaceBinaryWriter- Type Parameters:
K- Type of keys in the map to write.V- Type of mapped values in the map to write.- Parameters:
fieldName- Field name.map- Map to write.- Throws:
BinaryObjectException- In case of error.
-
writeMap
public <K,V> void writeMap(@Nullable @Nullable Map<K,V> map) throws BinaryObjectException- Specified by:
writeMapin interfaceBinaryRawWriter- Type Parameters:
K- Type of keys in the map to write.V- Type of mapped values in the map to write.- Parameters:
map- Map to write.- Throws:
BinaryObjectException- In case of error.
-
writeEnum
public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws BinaryObjectException
- Specified by:
writeEnumin interfaceBinaryWriter- Type Parameters:
T- Type of the enum to write.- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeEnum
public <T extends Enum<?>> void writeEnum(T val) throws BinaryObjectException
- Specified by:
writeEnumin interfaceBinaryRawWriter- Type Parameters:
T- Type of the enum to write.- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeEnumArray
public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException
- Specified by:
writeEnumArrayin interfaceBinaryWriter- Type Parameters:
T- Type of the enum values in array to write.- Parameters:
fieldName- Field name.val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
writeEnumArray
public <T extends Enum<?>> void writeEnumArray(T[] val) throws BinaryObjectException
- Specified by:
writeEnumArrayin interfaceBinaryRawWriter- Type Parameters:
T- Type of the enum values in array to write.- Parameters:
val- Value to write.- Throws:
BinaryObjectException- In case of error.
-
rawWriter
public BinaryRawWriter rawWriter()
Gets raw writer. Raw writer does not write field name hash codes, therefore, making the format even more compact. However, if the raw writer is used, dynamic structure changes to the binary objects are not supported.- Specified by:
rawWriterin interfaceBinaryWriter- Returns:
- Raw writer.
-
out
public BinaryOutputStream out()
- Specified by:
outin interfaceBinaryRawWriterEx- Returns:
- Output stream.
-
writeBytes
public void writeBytes(String s) throws IOException
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
public void writeChars(String s) throws IOException
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
public void writeUTF(String s) throws IOException
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
writeByte
public void writeByte(int v) throws IOException- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
public void writeShort(int v) throws IOException- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
public void writeChar(int v) throws IOException- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceObjectOutput- Throws:
IOException
-
reserveInt
public int reserveInt()
Reserve a room for an integer.- Specified by:
reserveIntin interfaceBinaryRawWriterEx- Returns:
- Position in the stream where value is to be written.
-
writeInt
public void writeInt(int pos, int val) throws BinaryObjectExceptionWrite int value at the specific position.- Specified by:
writeIntin interfaceBinaryRawWriterEx- Parameters:
pos- Position.val- Value.- Throws:
BinaryObjectException- If failed.
-
writeFieldId
public void writeFieldId(int fieldId)
Write field ID.- Parameters:
fieldId- Field ID.
-
writeFieldIdNoSchemaUpdate
public void writeFieldIdNoSchemaUpdate(int fieldId)
Write field ID without schema ID update. This method should be used when schema ID is stable because class is seializable.- Parameters:
fieldId- Field ID.
-
writeByteArray
public int writeByteArray(InputStream in, int limit) throws BinaryObjectException
Write byte array from the InputStream.If
limit> 0 than no more thanlimitbytes will be read and written. Iflimit== -1 than it will try to read and write all bytes.In any case if actual number of bytes is greater than
MAX_ARRAY_SIZEthan exception will be thrown.- Parameters:
in- InputStream.limit- Max length of data to be read from the stream or -1 if all data should be read.- Returns:
- Number of bytes written.
- Throws:
BinaryObjectException- If an I/O error occurs or stream contains more thanMAX_ARRAY_SIZEbytes.
-
schemaId
public void schemaId(int schemaId)
- Parameters:
schemaId- Schema ID.
-
schemaId
public int schemaId()
- Returns:
- Schema ID.
-
currentSchema
public BinarySchema currentSchema()
- Returns:
- Current writer's schema.
-
newWriter
public BinaryWriterExImpl newWriter(int typeId)
Create new writer with same context.- Parameters:
typeId- type- Returns:
- New writer.
-
context
public BinaryContext context()
- Returns:
- Binary context.
-
-