com.hazelcast.nio.serialization
Class DefaultPortableWriter

java.lang.Object
  extended by com.hazelcast.nio.serialization.DefaultPortableWriter
All Implemented Interfaces:
PortableWriter

public class DefaultPortableWriter
extends Object
implements PortableWriter


Constructor Summary
DefaultPortableWriter(com.hazelcast.nio.serialization.PortableSerializer serializer, BufferObjectDataOutput out, ClassDefinition cd)
           
 
Method Summary
 ObjectDataOutput getRawDataOutput()
          After writing portable fields, one can write remaining fields in old fashioned way consecutively at the end of stream.
 int getVersion()
           
 void writeBoolean(String fieldName, boolean value)
          Writes a primitive boolean.
 void writeByte(String fieldName, byte value)
          Writes a primitive byte.
 void writeByteArray(String fieldName, byte[] values)
          Writes a primitive byte-array.
 void writeChar(String fieldName, int value)
          Writes a primitive char.
 void writeCharArray(String fieldName, char[] values)
          Writes a primitive char-array.
 void 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[] values)
          Writes a primitive int-array.
 void writeLong(String fieldName, long value)
          Writes a primitive long.
 void writeLongArray(String fieldName, long[] values)
          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[] portables)
          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 writeUTF(String fieldName, String str)
          Writes an UTF string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPortableWriter

public DefaultPortableWriter(com.hazelcast.nio.serialization.PortableSerializer serializer,
                             BufferObjectDataOutput out,
                             ClassDefinition cd)
                      throws IOException
Throws:
IOException
Method Detail

getVersion

public int getVersion()

writeInt

public void writeInt(String fieldName,
                     int value)
              throws IOException
Description copied from interface: PortableWriter
Writes a primitive int.

Specified by:
writeInt in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeLong

public void writeLong(String fieldName,
                      long value)
               throws IOException
Description copied from interface: PortableWriter
Writes a primitive long.

Specified by:
writeLong in interface PortableWriter
Parameters:
fieldName - name of the field
value - long value to be written
Throws:
IOException

writeUTF

public void writeUTF(String fieldName,
                     String str)
              throws IOException
Description copied from interface: PortableWriter
Writes an UTF string.

Specified by:
writeUTF in interface PortableWriter
Parameters:
fieldName - name of the field
str - utf string value to be written
Throws:
IOException

writeBoolean

public void writeBoolean(String fieldName,
                         boolean value)
                  throws IOException
Description copied from interface: PortableWriter
Writes a primitive boolean.

Specified by:
writeBoolean in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeByte

public void writeByte(String fieldName,
                      byte value)
               throws IOException
Description copied from interface: PortableWriter
Writes a primitive byte.

Specified by:
writeByte in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeChar

public void writeChar(String fieldName,
                      int value)
               throws IOException
Description copied from interface: PortableWriter
Writes a primitive char.

Specified by:
writeChar in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeDouble

public void writeDouble(String fieldName,
                        double value)
                 throws IOException
Description copied from interface: PortableWriter
Writes a primitive double.

Specified by:
writeDouble in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeFloat

public void writeFloat(String fieldName,
                       float value)
                throws IOException
Description copied from interface: PortableWriter
Writes a primitive float.

Specified by:
writeFloat in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writeShort

public void writeShort(String fieldName,
                       short value)
                throws IOException
Description copied from interface: PortableWriter
Writes a primitive short.

Specified by:
writeShort in interface PortableWriter
Parameters:
fieldName - name of the field
value - int value to be written
Throws:
IOException

writePortable

public void writePortable(String fieldName,
                          Portable portable)
                   throws IOException
Description copied from interface: PortableWriter
Writes a Portable.

Specified by:
writePortable in interface PortableWriter
Parameters:
fieldName - name of the field
portable - Portable to be written
Throws:
IOException

writeNullPortable

public void writeNullPortable(String fieldName,
                              int factoryId,
                              int classId)
                       throws IOException
Description copied from interface: PortableWriter
To write a null portable value, user needs to provide class and factoryIds of related class.

Specified by:
writeNullPortable in interface PortableWriter
Parameters:
fieldName - name of the field
factoryId - factory id of related portable class
classId - class id of related portable class
Throws:
IOException

writeByteArray

public void writeByteArray(String fieldName,
                           byte[] values)
                    throws IOException
Description copied from interface: PortableWriter
Writes a primitive byte-array.

Specified by:
writeByteArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - byte array to be written
Throws:
IOException

writeCharArray

public void writeCharArray(String fieldName,
                           char[] values)
                    throws IOException
Description copied from interface: PortableWriter
Writes a primitive char-array.

Specified by:
writeCharArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - char array to be written
Throws:
IOException

writeIntArray

public void writeIntArray(String fieldName,
                          int[] values)
                   throws IOException
Description copied from interface: PortableWriter
Writes a primitive int-array.

Specified by:
writeIntArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - int array to be written
Throws:
IOException

writeLongArray

public void writeLongArray(String fieldName,
                           long[] values)
                    throws IOException
Description copied from interface: PortableWriter
Writes a primitive long-array.

Specified by:
writeLongArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - long array to be written
Throws:
IOException

writeDoubleArray

public void writeDoubleArray(String fieldName,
                             double[] values)
                      throws IOException
Description copied from interface: PortableWriter
Writes a primitive double array.

Specified by:
writeDoubleArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - double array to be written
Throws:
IOException

writeFloatArray

public void writeFloatArray(String fieldName,
                            float[] values)
                     throws IOException
Description copied from interface: PortableWriter
Writes a primitive float array.

Specified by:
writeFloatArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - float array to be written
Throws:
IOException

writeShortArray

public void writeShortArray(String fieldName,
                            short[] values)
                     throws IOException
Description copied from interface: PortableWriter
Writes a primitive short-array.

Specified by:
writeShortArray in interface PortableWriter
Parameters:
fieldName - name of the field
values - short array to be written
Throws:
IOException

writePortableArray

public void writePortableArray(String fieldName,
                               Portable[] portables)
                        throws IOException
Description copied from interface: PortableWriter
Writes a an array of Portables.

Specified by:
writePortableArray in interface PortableWriter
Parameters:
fieldName - name of the field
portables - portable array to be written
Throws:
IOException

getRawDataOutput

public ObjectDataOutput getRawDataOutput()
                                  throws IOException
Description copied from interface: PortableWriter
After writing portable fields, one can write remaining fields in old fashioned way consecutively at the end of stream. User should not that after getting raw dataoutput trying to write portable fields will result in IOException

Specified by:
getRawDataOutput in interface PortableWriter
Returns:
ObjectDataOutput
Throws:
IOException


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.