Package com.hazelcast.nio.serialization
Interface PortableWriter
public interface PortableWriter
Provides means for writing portable fields to binary data in the form of java primitives,
arrays of java primitives, nested portable fields and arrays of portable fields.
-
Method Summary
Modifier and Type Method Description ObjectDataOutput
getRawDataOutput()
After writing portable fields one can subsequently write remaining fields in the old-fashioned way.void
writeBoolean(String fieldName, boolean value)
Writes a primitive boolean.void
writeBooleanArray(String fieldName, boolean[] booleans)
Writes a primitive boolean-array.void
writeByte(String fieldName, byte value)
Writes a primitive byte.void
writeByteArray(String fieldName, byte[] bytes)
Writes a primitive byte-array.void
writeChar(String fieldName, int value)
Writes a primitive char.void
writeCharArray(String fieldName, char[] chars)
Writes a primitive char-array.void
writeDate(String fieldName, LocalDate value)
Writes a date field consisting of year, month of the year and day of the monthvoid
writeDateArray(String fieldName, LocalDate[] values)
Writes an array of Date'svoid
writeDecimal(String fieldName, BigDecimal value)
Writes a decimal which is arbitrary precision and scale floating-point numbervoid
writeDecimalArray(String fieldName, BigDecimal[] values)
Writes an array of Decimalsvoid
writeDouble(String fieldName, double value)
Writes a primitive double.void
writeDoubleArray(String fieldName, double[] values)
Writes a primitive double array.void
writeFloat(String fieldName, float value)
Writes a primitive float.void
writeFloatArray(String fieldName, float[] values)
Writes a primitive float array.void
writeInt(String fieldName, int value)
Writes a primitive int.void
writeIntArray(String fieldName, int[] ints)
Writes a primitive int-array.void
writeLong(String fieldName, long value)
Writes a primitive long.void
writeLongArray(String fieldName, long[] longs)
Writes a primitive long-array.void
writeNullPortable(String fieldName, int factoryId, int classId)
To write a null portable value, user needs to provide class and factoryIds of related class.void
writePortable(String fieldName, Portable portable)
Writes a Portable.void
writePortableArray(String fieldName, Portable[] values)
Writes a an array of Portables.void
writeShort(String fieldName, short value)
Writes a primitive short.void
writeShortArray(String fieldName, short[] values)
Writes a primitive short-array.void
writeString(String fieldName, String value)
Writes an UTF string.void
writeStringArray(String fieldName, String[] values)
Writes a String-array.void
writeTime(String fieldName, LocalTime value)
Write a time field consisting of hour, minute, seconds and nanos partsvoid
writeTimeArray(String fieldName, LocalTime[] values)
Writes an array of Time'svoid
writeTimestamp(String fieldName, LocalDateTime value)
Writes a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos partsvoid
writeTimestampArray(String fieldName, LocalDateTime[] values)
Writes an array of Timestamp'svoid
writeTimestampWithTimezone(String fieldName, OffsetDateTime value)
Writes a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos partsvoid
writeTimestampWithTimezoneArray(String fieldName, OffsetDateTime[] values)
Writes an array of TimestampWithTimezone'svoid
writeUTF(String fieldName, String value)
Deprecated.for the sake of better naming.void
writeUTFArray(String fieldName, String[] values)
Deprecated.for the sake of better naming.
-
Method Details
-
writeInt
Writes a primitive int.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeLong
Writes a primitive long.- Parameters:
fieldName
- name of the fieldvalue
- long value to be written- Throws:
IOException
- in case of any exceptional case
-
writeUTF
Deprecated.for the sake of better naming. UsewriteString(String, String)
instead.Writes an UTF string.- Parameters:
fieldName
- name of the fieldvalue
- utf string value to be written- Throws:
IOException
- in case of any exceptional case
-
writeString
Writes an UTF string.- Parameters:
fieldName
- name of the fieldvalue
- utf string value to be written- Throws:
IOException
- in case of any exceptional case
-
writeBoolean
Writes a primitive boolean.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeByte
Writes a primitive byte.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeChar
Writes a primitive char.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeDouble
Writes a primitive double.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeFloat
Writes a primitive float.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writeShort
Writes a primitive short.- Parameters:
fieldName
- name of the fieldvalue
- int value to be written- Throws:
IOException
- in case of any exceptional case
-
writePortable
Writes a Portable. UsewriteNullPortable(String, int, int)
to write anull
Portable- Parameters:
fieldName
- name of the fieldportable
- Portable to be written- Throws:
IOException
- in case of any exceptional case
-
writeNullPortable
To write a null portable value, user needs to provide class and factoryIds of related class.- Parameters:
fieldName
- name of the fieldfactoryId
- factory ID of related portable classclassId
- class ID of related portable class- Throws:
IOException
- in case of any exceptional case
-
writeDecimal
Writes a decimal which is arbitrary precision and scale floating-point number- Parameters:
fieldName
- name of the fieldvalue
- BigDecimal value to be written- Throws:
IOException
- in case of any exceptional case
-
writeTime
Write a time field consisting of hour, minute, seconds and nanos parts- Parameters:
fieldName
- name of the fieldvalue
- LocalTime value to be written- Throws:
IOException
- in case of any exceptional case
-
writeDate
Writes a date field consisting of year, month of the year and day of the month- Parameters:
fieldName
- name of the fieldvalue
- LocalDate value to be written- Throws:
IOException
- in case of any exceptional case
-
writeTimestamp
Writes a timestamp field consisting of year, month of the year, day of the month, hour, minute, seconds, nanos parts- Parameters:
fieldName
- name of the fieldvalue
- LocalDateTime value to be written- Throws:
IOException
- in case of any exceptional case
-
writeTimestampWithTimezone
void writeTimestampWithTimezone(@Nonnull String fieldName, @Nullable OffsetDateTime value) throws IOExceptionWrites a timestamp with timezone field consisting of year, month of the year, day of the month, offset seconds, hour, minute, seconds, nanos parts- Parameters:
fieldName
- name of the fieldvalue
- OffsetDateTime value to be written- Throws:
IOException
- in case of any exceptional case
-
writeByteArray
Writes a primitive byte-array.- Parameters:
fieldName
- name of the fieldbytes
- byte array to be written- Throws:
IOException
- in case of any exceptional case
-
writeBooleanArray
Writes a primitive boolean-array.- Parameters:
fieldName
- name of the fieldbooleans
- boolean array to be written- Throws:
IOException
- in case of any exceptional case
-
writeCharArray
Writes a primitive char-array.- Parameters:
fieldName
- name of the fieldchars
- char array to be written- Throws:
IOException
- in case of any exceptional case
-
writeIntArray
Writes a primitive int-array.- Parameters:
fieldName
- name of the fieldints
- int array to be written- Throws:
IOException
- in case of any exceptional case
-
writeLongArray
Writes a primitive long-array.- Parameters:
fieldName
- name of the fieldlongs
- long array to be written- Throws:
IOException
- in case of any exceptional case
-
writeDoubleArray
Writes a primitive double array.- Parameters:
fieldName
- name of the fieldvalues
- double array to be written- Throws:
IOException
- in case of any exceptional case
-
writeFloatArray
Writes a primitive float array.- Parameters:
fieldName
- name of the fieldvalues
- float array to be written- Throws:
IOException
- in case of any exceptional case
-
writeShortArray
Writes a primitive short-array.- Parameters:
fieldName
- name of the fieldvalues
- short array to be written- Throws:
IOException
- in case of any exceptional case
-
writeUTFArray
@Deprecated void writeUTFArray(@Nonnull String fieldName, @Nullable String[] values) throws IOExceptionDeprecated.for the sake of better naming. UsewriteStringArray(String, String[])
instead.Writes a String-array.- Parameters:
fieldName
- name of the fieldvalues
- String array to be written- Throws:
IOException
- in case of any exceptional case
-
writeStringArray
Writes a String-array.- Parameters:
fieldName
- name of the fieldvalues
- String array to be written- Throws:
IOException
- in case of any exceptional case
-
writePortableArray
Writes a an array of Portables.- Parameters:
fieldName
- name of the fieldvalues
- portable array to be written- Throws:
IOException
- in case of any exceptional case
-
writeDecimalArray
void writeDecimalArray(@Nonnull String fieldName, @Nullable BigDecimal[] values) throws IOExceptionWrites an array of Decimals- Parameters:
fieldName
- name of the fieldvalues
- BigDecimal array to be written- Throws:
IOException
- in case of any exceptional case- See Also:
writeDecimal(String, BigDecimal)
-
writeTimeArray
Writes an array of Time's- Parameters:
fieldName
- name of the fieldvalues
- LocalTime array to be written- Throws:
IOException
- in case of any exceptional case- See Also:
writeTime(String, LocalTime)
-
writeDateArray
Writes an array of Date's- Parameters:
fieldName
- name of the fieldvalues
- LocalDate array to be written- Throws:
IOException
- in case of any exceptional case- See Also:
writeDate(String, LocalDate)
-
writeTimestampArray
void writeTimestampArray(@Nonnull String fieldName, @Nullable LocalDateTime[] values) throws IOExceptionWrites an array of Timestamp's- Parameters:
fieldName
- name of the fieldvalues
- LocalDateTime array to be written- Throws:
IOException
- in case of any exceptional case- See Also:
writeTimestamp(String, LocalDateTime)
-
writeTimestampWithTimezoneArray
void writeTimestampWithTimezoneArray(@Nonnull String fieldName, @Nullable OffsetDateTime[] values) throws IOExceptionWrites an array of TimestampWithTimezone's- Parameters:
fieldName
- name of the fieldvalues
- OffsetDateTime array to be written- Throws:
IOException
- in case of any exceptional case- See Also:
writeTimestampWithTimezone(String, OffsetDateTime)
-
getRawDataOutput
After writing portable fields one can subsequently write remaining fields in the old-fashioned way. Users should note that after calling this method, trying to write portable fields will result in an IOException.- Returns:
- ObjectDataOutput
- Throws:
IOException
- in case of any exceptional case
-