org.apache.thrift.protocol
Class TSimpleJSONProtocol

java.lang.Object
  extended by org.apache.thrift.protocol.TProtocol
      extended by org.apache.thrift.protocol.TSimpleJSONProtocol

public class TSimpleJSONProtocol
extends TProtocol

JSON protocol implementation for thrift. This protocol is write-only and produces a simple output format suitable for parsing by scripting languages. It should not be confused with the full-featured TJSONProtocol.


Nested Class Summary
protected  class TSimpleJSONProtocol.Context
           
static class TSimpleJSONProtocol.Factory
          Factory
protected  class TSimpleJSONProtocol.ListContext
           
protected  class TSimpleJSONProtocol.StructContext
           
 
Field Summary
protected  TSimpleJSONProtocol.Context BASE_CONTEXT
           
static byte[] COLON
           
static byte[] COMMA
           
static byte[] LBRACE
           
static byte[] LBRACKET
           
static char QUOTE
           
static byte[] RBRACE
           
static byte[] RBRACKET
           
protected  TSimpleJSONProtocol.Context writeContext_
          Current context that we are in
protected  java.util.Stack<TSimpleJSONProtocol.Context> writeContextStack_
          Stack of nested contexts that we may be in.
 
Fields inherited from class org.apache.thrift.protocol.TProtocol
trans_
 
Constructor Summary
TSimpleJSONProtocol(TTransport trans)
          Constructor
 
Method Summary
 void _writeStringData(java.lang.String s)
           
protected  void popWriteContext()
          Pop the last write context off the stack
protected  void pushWriteContext(TSimpleJSONProtocol.Context c)
          Push a new write context onto the stack.
 java.nio.ByteBuffer readBinary()
           
 boolean readBool()
           
 byte readByte()
           
 double readDouble()
           
 TField readFieldBegin()
           
 void readFieldEnd()
           
 short readI16()
           
 int readI32()
           
 long readI64()
           
 TList readListBegin()
           
 void readListEnd()
           
 TMap readMapBegin()
           
 void readMapEnd()
           
 TMessage readMessageBegin()
          Reading methods.
 void readMessageEnd()
           
 TSet readSetBegin()
           
 void readSetEnd()
           
 java.lang.String readString()
           
 java.lang.String readStringBody(int size)
           
 TStruct readStructBegin()
           
 void readStructEnd()
           
 void writeBinary(java.nio.ByteBuffer bin)
           
 void writeBool(boolean b)
           
 void writeByte(byte b)
           
 void writeDouble(double dub)
           
 void writeFieldBegin(TField field)
           
 void writeFieldEnd()
           
 void writeFieldStop()
           
 void writeI16(short i16)
           
 void writeI32(int i32)
           
 void writeI64(long i64)
           
 void writeListBegin(TList list)
           
 void writeListEnd()
           
 void writeMapBegin(TMap map)
           
 void writeMapEnd()
           
 void writeMessageBegin(TMessage message)
          Writing methods.
 void writeMessageEnd()
           
 void writeSetBegin(TSet set)
           
 void writeSetEnd()
           
 void writeString(java.lang.String str)
           
 void writeStructBegin(TStruct struct)
           
 void writeStructEnd()
           
 
Methods inherited from class org.apache.thrift.protocol.TProtocol
getScheme, getTransport, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMA

public static final byte[] COMMA

COLON

public static final byte[] COLON

LBRACE

public static final byte[] LBRACE

RBRACE

public static final byte[] RBRACE

LBRACKET

public static final byte[] LBRACKET

RBRACKET

public static final byte[] RBRACKET

QUOTE

public static final char QUOTE
See Also:
Constant Field Values

BASE_CONTEXT

protected final TSimpleJSONProtocol.Context BASE_CONTEXT

writeContextStack_

protected java.util.Stack<TSimpleJSONProtocol.Context> writeContextStack_
Stack of nested contexts that we may be in.


writeContext_

protected TSimpleJSONProtocol.Context writeContext_
Current context that we are in

Constructor Detail

TSimpleJSONProtocol

public TSimpleJSONProtocol(TTransport trans)
Constructor

Method Detail

pushWriteContext

protected void pushWriteContext(TSimpleJSONProtocol.Context c)
Push a new write context onto the stack.


popWriteContext

protected void popWriteContext()
Pop the last write context off the stack


writeMessageBegin

public void writeMessageBegin(TMessage message)
                       throws TException
Description copied from class: TProtocol
Writing methods.

Specified by:
writeMessageBegin in class TProtocol
Throws:
TException

writeMessageEnd

public void writeMessageEnd()
                     throws TException
Specified by:
writeMessageEnd in class TProtocol
Throws:
TException

writeStructBegin

public void writeStructBegin(TStruct struct)
                      throws TException
Specified by:
writeStructBegin in class TProtocol
Throws:
TException

writeStructEnd

public void writeStructEnd()
                    throws TException
Specified by:
writeStructEnd in class TProtocol
Throws:
TException

writeFieldBegin

public void writeFieldBegin(TField field)
                     throws TException
Specified by:
writeFieldBegin in class TProtocol
Throws:
TException

writeFieldEnd

public void writeFieldEnd()
Specified by:
writeFieldEnd in class TProtocol

writeFieldStop

public void writeFieldStop()
Specified by:
writeFieldStop in class TProtocol

writeMapBegin

public void writeMapBegin(TMap map)
                   throws TException
Specified by:
writeMapBegin in class TProtocol
Throws:
TException

writeMapEnd

public void writeMapEnd()
                 throws TException
Specified by:
writeMapEnd in class TProtocol
Throws:
TException

writeListBegin

public void writeListBegin(TList list)
                    throws TException
Specified by:
writeListBegin in class TProtocol
Throws:
TException

writeListEnd

public void writeListEnd()
                  throws TException
Specified by:
writeListEnd in class TProtocol
Throws:
TException

writeSetBegin

public void writeSetBegin(TSet set)
                   throws TException
Specified by:
writeSetBegin in class TProtocol
Throws:
TException

writeSetEnd

public void writeSetEnd()
                 throws TException
Specified by:
writeSetEnd in class TProtocol
Throws:
TException

writeBool

public void writeBool(boolean b)
               throws TException
Specified by:
writeBool in class TProtocol
Throws:
TException

writeByte

public void writeByte(byte b)
               throws TException
Specified by:
writeByte in class TProtocol
Throws:
TException

writeI16

public void writeI16(short i16)
              throws TException
Specified by:
writeI16 in class TProtocol
Throws:
TException

writeI32

public void writeI32(int i32)
              throws TException
Specified by:
writeI32 in class TProtocol
Throws:
TException

_writeStringData

public void _writeStringData(java.lang.String s)
                      throws TException
Throws:
TException

writeI64

public void writeI64(long i64)
              throws TException
Specified by:
writeI64 in class TProtocol
Throws:
TException

writeDouble

public void writeDouble(double dub)
                 throws TException
Specified by:
writeDouble in class TProtocol
Throws:
TException

writeString

public void writeString(java.lang.String str)
                 throws TException
Specified by:
writeString in class TProtocol
Throws:
TException

writeBinary

public void writeBinary(java.nio.ByteBuffer bin)
                 throws TException
Specified by:
writeBinary in class TProtocol
Throws:
TException

readMessageBegin

public TMessage readMessageBegin()
                          throws TException
Reading methods.

Specified by:
readMessageBegin in class TProtocol
Throws:
TException

readMessageEnd

public void readMessageEnd()
Specified by:
readMessageEnd in class TProtocol

readStructBegin

public TStruct readStructBegin()
Specified by:
readStructBegin in class TProtocol

readStructEnd

public void readStructEnd()
Specified by:
readStructEnd in class TProtocol

readFieldBegin

public TField readFieldBegin()
                      throws TException
Specified by:
readFieldBegin in class TProtocol
Throws:
TException

readFieldEnd

public void readFieldEnd()
Specified by:
readFieldEnd in class TProtocol

readMapBegin

public TMap readMapBegin()
                  throws TException
Specified by:
readMapBegin in class TProtocol
Throws:
TException

readMapEnd

public void readMapEnd()
Specified by:
readMapEnd in class TProtocol

readListBegin

public TList readListBegin()
                    throws TException
Specified by:
readListBegin in class TProtocol
Throws:
TException

readListEnd

public void readListEnd()
Specified by:
readListEnd in class TProtocol

readSetBegin

public TSet readSetBegin()
                  throws TException
Specified by:
readSetBegin in class TProtocol
Throws:
TException

readSetEnd

public void readSetEnd()
Specified by:
readSetEnd in class TProtocol

readBool

public boolean readBool()
                 throws TException
Specified by:
readBool in class TProtocol
Throws:
TException

readByte

public byte readByte()
              throws TException
Specified by:
readByte in class TProtocol
Throws:
TException

readI16

public short readI16()
              throws TException
Specified by:
readI16 in class TProtocol
Throws:
TException

readI32

public int readI32()
            throws TException
Specified by:
readI32 in class TProtocol
Throws:
TException

readI64

public long readI64()
             throws TException
Specified by:
readI64 in class TProtocol
Throws:
TException

readDouble

public double readDouble()
                  throws TException
Specified by:
readDouble in class TProtocol
Throws:
TException

readString

public java.lang.String readString()
                            throws TException
Specified by:
readString in class TProtocol
Throws:
TException

readStringBody

public java.lang.String readStringBody(int size)
                                throws TException
Throws:
TException

readBinary

public java.nio.ByteBuffer readBinary()
                               throws TException
Specified by:
readBinary in class TProtocol
Throws:
TException