com.hazelcast.nio.serialization
Class DefaultPortableReader

java.lang.Object
  extended by com.hazelcast.nio.serialization.DefaultPortableReader
All Implemented Interfaces:
PortableReader
Direct Known Subclasses:
MorphingPortableReader

public class DefaultPortableReader
extends Object
implements PortableReader


Field Summary
protected  ClassDefinition cd
           
 
Constructor Summary
DefaultPortableReader(com.hazelcast.nio.serialization.PortableSerializer serializer, BufferObjectDataInput in, ClassDefinition cd)
           
 
Method Summary
 int getFieldClassId(String fieldName)
           
 Set<String> getFieldNames()
           
 FieldType getFieldType(String fieldName)
           
 ObjectDataInput getRawDataInput()
          PortableWriter.getRawDataOutput().
 int getVersion()
           
 boolean hasField(String fieldName)
           
 boolean readBoolean(String fieldName)
           
 byte readByte(String fieldName)
           
 byte[] readByteArray(String fieldName)
           
 char readChar(String fieldName)
           
 char[] readCharArray(String fieldName)
           
 double readDouble(String fieldName)
           
 double[] readDoubleArray(String fieldName)
           
 float readFloat(String fieldName)
           
 float[] readFloatArray(String fieldName)
           
 int readInt(String fieldName)
           
 int[] readIntArray(String fieldName)
           
 long readLong(String fieldName)
           
 long[] readLongArray(String fieldName)
           
 Portable readPortable(String fieldName)
           
 Portable[] readPortableArray(String fieldName)
           
 short readShort(String fieldName)
           
 short[] readShortArray(String fieldName)
           
 String readUTF(String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cd

protected final ClassDefinition cd
Constructor Detail

DefaultPortableReader

public DefaultPortableReader(com.hazelcast.nio.serialization.PortableSerializer serializer,
                             BufferObjectDataInput in,
                             ClassDefinition cd)
Method Detail

getVersion

public int getVersion()
Specified by:
getVersion in interface PortableReader
Returns:
version global version of portable classes

hasField

public boolean hasField(String fieldName)
Specified by:
hasField in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
true if field exist in this class.

getFieldNames

public Set<String> getFieldNames()
Specified by:
getFieldNames in interface PortableReader
Returns:
set of field names on this portable class

getFieldType

public FieldType getFieldType(String fieldName)
Specified by:
getFieldType in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
field type of given fieldName

getFieldClassId

public int getFieldClassId(String fieldName)
Specified by:
getFieldClassId in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
classId of given field

readInt

public int readInt(String fieldName)
            throws IOException
Specified by:
readInt in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the int value read
Throws:
IOException

readLong

public long readLong(String fieldName)
              throws IOException
Specified by:
readLong in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the long value read
Throws:
IOException

readUTF

public String readUTF(String fieldName)
               throws IOException
Specified by:
readUTF in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the utf string value read
Throws:
IOException

readBoolean

public boolean readBoolean(String fieldName)
                    throws IOException
Specified by:
readBoolean in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the boolean value read
Throws:
IOException

readByte

public byte readByte(String fieldName)
              throws IOException
Specified by:
readByte in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the byte value read
Throws:
IOException

readChar

public char readChar(String fieldName)
              throws IOException
Specified by:
readChar in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the char value read
Throws:
IOException

readDouble

public double readDouble(String fieldName)
                  throws IOException
Specified by:
readDouble in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the double value read
Throws:
IOException

readFloat

public float readFloat(String fieldName)
                throws IOException
Specified by:
readFloat in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the float value read
Throws:
IOException

readShort

public short readShort(String fieldName)
                throws IOException
Specified by:
readShort in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the short value read
Throws:
IOException

readByteArray

public byte[] readByteArray(String fieldName)
                     throws IOException
Specified by:
readByteArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the byte array value read
Throws:
IOException

readCharArray

public char[] readCharArray(String fieldName)
                     throws IOException
Specified by:
readCharArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the char array value read
Throws:
IOException

readIntArray

public int[] readIntArray(String fieldName)
                   throws IOException
Specified by:
readIntArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the int array value read
Throws:
IOException

readLongArray

public long[] readLongArray(String fieldName)
                     throws IOException
Specified by:
readLongArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the long array value read
Throws:
IOException

readDoubleArray

public double[] readDoubleArray(String fieldName)
                         throws IOException
Specified by:
readDoubleArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the double array value read
Throws:
IOException

readFloatArray

public float[] readFloatArray(String fieldName)
                       throws IOException
Specified by:
readFloatArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the float array value read
Throws:
IOException

readShortArray

public short[] readShortArray(String fieldName)
                       throws IOException
Specified by:
readShortArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the short array value read
Throws:
IOException

readPortable

public Portable readPortable(String fieldName)
                      throws IOException
Specified by:
readPortable in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the portable value read
Throws:
IOException

readPortableArray

public Portable[] readPortableArray(String fieldName)
                             throws IOException
Specified by:
readPortableArray in interface PortableReader
Parameters:
fieldName - name of the field
Returns:
the portabke value read
Throws:
IOException

getRawDataInput

public ObjectDataInput getRawDataInput()
                                throws IOException
Description copied from interface: PortableReader
PortableWriter.getRawDataOutput().

Note that portable fields can not read after getRawDataInput() is called. In case this happens, IOException will be thrown.

Specified by:
getRawDataInput in interface PortableReader
Returns:
rawDataInput
Throws:
IOException


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