com.dyuproject.protostuff
Class JsonInput

java.lang.Object
  extended by com.dyuproject.protostuff.JsonInput
All Implemented Interfaces:
Input

public final class JsonInput
extends java.lang.Object
implements Input

An input used for reading data with json format.

Author:
David Yu
Date created:
Nov 20, 2009

Constructor Summary
JsonInput(org.codehaus.jackson.JsonParser parser)
           
JsonInput(org.codehaus.jackson.JsonParser parser, boolean numeric)
           
 
Method Summary
 int getLastNumber()
          Gets the last field number read.
<T> void
handleUnknownField(int fieldNumber, Schema<T> schema)
           
 boolean isLastRepeated()
          Returns true if the last read field was a repeated field.
 boolean isNumeric()
          Returns whether the incoming messages' field names are numeric.
<T> T
mergeObject(T value, Schema<T> schema)
           
 boolean readBool()
           
 byte[] readByteArray()
           
 ByteString readBytes()
           
 double readDouble()
           
 int readEnum()
           
<T> int
readFieldNumber(Schema<T> schema)
           
 int readFixed32()
           
 long readFixed64()
           
 float readFloat()
           
 int readInt32()
           
 long readInt64()
           
 int readSFixed32()
           
 long readSFixed64()
           
 int readSInt32()
           
 long readSInt64()
           
 java.lang.String readString()
           
 int readUInt32()
           
 long readUInt64()
           
 JsonInput reset()
          Resets this input.
 void transferByteRangeTo(Output output, boolean utf8String, int fieldNumber, boolean repeated)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonInput

public JsonInput(org.codehaus.jackson.JsonParser parser)

JsonInput

public JsonInput(org.codehaus.jackson.JsonParser parser,
                 boolean numeric)
Method Detail

isNumeric

public boolean isNumeric()
Returns whether the incoming messages' field names are numeric.


getLastNumber

public int getLastNumber()
Gets the last field number read.


isLastRepeated

public boolean isLastRepeated()
Returns true if the last read field was a repeated field.


reset

public JsonInput reset()
Resets this input.


handleUnknownField

public <T> void handleUnknownField(int fieldNumber,
                                   Schema<T> schema)
                        throws java.io.IOException
Specified by:
handleUnknownField in interface Input
Throws:
java.io.IOException

readFieldNumber

public <T> int readFieldNumber(Schema<T> schema)
                    throws java.io.IOException
Specified by:
readFieldNumber in interface Input
Throws:
java.io.IOException

readBool

public boolean readBool()
                 throws java.io.IOException
Specified by:
readBool in interface Input
Throws:
java.io.IOException

readByteArray

public byte[] readByteArray()
                     throws java.io.IOException
Specified by:
readByteArray in interface Input
Throws:
java.io.IOException

readBytes

public ByteString readBytes()
                     throws java.io.IOException
Specified by:
readBytes in interface Input
Throws:
java.io.IOException

readDouble

public double readDouble()
                  throws java.io.IOException
Specified by:
readDouble in interface Input
Throws:
java.io.IOException

readEnum

public int readEnum()
             throws java.io.IOException
Specified by:
readEnum in interface Input
Throws:
java.io.IOException

readFixed32

public int readFixed32()
                throws java.io.IOException
Specified by:
readFixed32 in interface Input
Throws:
java.io.IOException

readFixed64

public long readFixed64()
                 throws java.io.IOException
Specified by:
readFixed64 in interface Input
Throws:
java.io.IOException

readFloat

public float readFloat()
                throws java.io.IOException
Specified by:
readFloat in interface Input
Throws:
java.io.IOException

readInt32

public int readInt32()
              throws java.io.IOException
Specified by:
readInt32 in interface Input
Throws:
java.io.IOException

readInt64

public long readInt64()
               throws java.io.IOException
Specified by:
readInt64 in interface Input
Throws:
java.io.IOException

readSFixed32

public int readSFixed32()
                 throws java.io.IOException
Specified by:
readSFixed32 in interface Input
Throws:
java.io.IOException

readSFixed64

public long readSFixed64()
                  throws java.io.IOException
Specified by:
readSFixed64 in interface Input
Throws:
java.io.IOException

readSInt32

public int readSInt32()
               throws java.io.IOException
Specified by:
readSInt32 in interface Input
Throws:
java.io.IOException

readSInt64

public long readSInt64()
                throws java.io.IOException
Specified by:
readSInt64 in interface Input
Throws:
java.io.IOException

readString

public java.lang.String readString()
                            throws java.io.IOException
Specified by:
readString in interface Input
Throws:
java.io.IOException

readUInt32

public int readUInt32()
               throws java.io.IOException
Specified by:
readUInt32 in interface Input
Throws:
java.io.IOException

readUInt64

public long readUInt64()
                throws java.io.IOException
Specified by:
readUInt64 in interface Input
Throws:
java.io.IOException

mergeObject

public <T> T mergeObject(T value,
                         Schema<T> schema)
              throws java.io.IOException
Specified by:
mergeObject in interface Input
Throws:
java.io.IOException

transferByteRangeTo

public void transferByteRangeTo(Output output,
                                boolean utf8String,
                                int fieldNumber,
                                boolean repeated)
                         throws java.io.IOException
Specified by:
transferByteRangeTo in interface Input
Throws:
java.io.IOException


Copyright © 2009-2012. All Rights Reserved.