\Thrift\ProtocolTJSONProtocol

JSON implementation of thrift protocol, ported from Java.

Summary

Methods
Properties
Constants
__construct()
getTransport()
writeMessageBegin()
writeMessageEnd()
writeStructBegin()
writeStructEnd()
writeFieldBegin()
writeFieldEnd()
writeFieldStop()
writeMapBegin()
writeMapEnd()
writeListBegin()
writeListEnd()
writeSetBegin()
writeSetEnd()
writeBool()
writeByte()
writeI16()
writeI32()
writeI64()
writeDouble()
writeString()
readMessageBegin()
readMessageEnd()
readStructBegin()
readStructEnd()
readFieldBegin()
readFieldEnd()
readMapBegin()
readMapEnd()
readListBegin()
readListEnd()
readSetBegin()
readSetEnd()
readBool()
readByte()
readI16()
readI32()
readI64()
readDouble()
readString()
skip()
skipBinary()
reset()
readJSONSyntaxChar()
$JSON_CHAR_TABLE
$ESCAPE_CHARS
$ESCAPE_CHAR_VALS
$contextStack_
$context_
$reader_
COMMA
COLON
LBRACE
RBRACE
LBRACKET
RBRACKET
QUOTE
BACKSLASH
ZERO
ESCSEQ
DOUBLEESC
VERSION
NAME_BOOL
NAME_BYTE
NAME_I16
NAME_I32
NAME_I64
NAME_DOUBLE
NAME_STRUCT
NAME_STRING
NAME_MAP
NAME_LIST
NAME_SET
No protected methods found
$trans_
N/A
getTypeNameForTypeID()
getTypeIDForTypeName()
pushContext()
popContext()
hexVal()
hexChar()
hasJSONUnescapedUnicode()
unescapedUnicode()
writeJSONString()
writeJSONInteger()
writeJSONDouble()
writeJSONBase64()
writeJSONObjectStart()
writeJSONObjectEnd()
writeJSONArrayStart()
writeJSONArrayEnd()
readJSONString()
isJSONNumeric()
readJSONNumericChars()
readJSONInteger()
readJSONIntegerAsString()
readJSONDouble()
readJSONBase64()
readJSONObjectStart()
readJSONObjectEnd()
readJSONArrayStart()
readJSONArrayEnd()
$tmpbuf_
N/A

Constants

COMMA

COMMA = ','

COLON

COLON = ':'

LBRACE

LBRACE = '{'

RBRACE

RBRACE = '}'

LBRACKET

LBRACKET = '['

RBRACKET

RBRACKET = ']'

QUOTE

QUOTE = '"'

BACKSLASH

BACKSLASH = '\\'

ZERO

ZERO = '0'

ESCSEQ

ESCSEQ = '\\'

DOUBLEESC

DOUBLEESC = '__DOUBLE_ESCAPE_SEQUENCE__'

VERSION

VERSION = 1

NAME_BOOL

NAME_BOOL = "tf"

NAME_BYTE

NAME_BYTE = "i8"

NAME_I16

NAME_I16 = "i16"

NAME_I32

NAME_I32 = "i32"

NAME_I64

NAME_I64 = "i64"

NAME_DOUBLE

NAME_DOUBLE = "dbl"

NAME_STRUCT

NAME_STRUCT = "rec"

NAME_STRING

NAME_STRING = "str"

NAME_MAP

NAME_MAP = "map"

NAME_LIST

NAME_LIST = "lst"

NAME_SET

NAME_SET = "set"

Properties

$JSON_CHAR_TABLE

$JSON_CHAR_TABLE : 

Type

$ESCAPE_CHARS

$ESCAPE_CHARS : 

Type

$ESCAPE_CHAR_VALS

$ESCAPE_CHAR_VALS : 

Type

$contextStack_

$contextStack_ : 

Type

$context_

$context_ : 

Type

$reader_

$reader_ : 

Type

$trans_

$trans_ : \Thrift\Protocol\TTransport

Underlying transport

Type

\Thrift\Protocol\TTransport

$tmpbuf_

$tmpbuf_ : 

Type

Methods

__construct()

__construct(  $trans) 

Constructor

Parameters

$trans

getTransport()

getTransport() : \Thrift\Protocol\TTransport

Accessor for transport

Returns

\Thrift\Protocol\TTransport

writeMessageBegin()

writeMessageBegin(string  $name, integer  $type, integer  $seqid) 

Writes the message header

Parameters

string $name

Function name

integer $type

message type TMessageType::CALL or TMessageType::REPLY

integer $seqid

The sequence id of this message

writeMessageEnd()

writeMessageEnd() 

Close the message

writeStructBegin()

writeStructBegin(string  $name) : integer

Writes a struct header.

Parameters

string $name

Struct name

Throws

\Thrift\Protocol\TException

on write error

Returns

integer —

How many bytes written

writeStructEnd()

writeStructEnd() : integer

Close a struct.

Throws

\Thrift\Protocol\TException

on write error

Returns

integer —

How many bytes written

writeFieldBegin()

writeFieldBegin(  $fieldName,   $fieldType,   $fieldId) 

Parameters

$fieldName
$fieldType
$fieldId

writeFieldEnd()

writeFieldEnd() 

writeFieldStop()

writeFieldStop() 

writeMapBegin()

writeMapBegin(  $keyType,   $valType,   $size) 

Parameters

$keyType
$valType
$size

writeMapEnd()

writeMapEnd() 

writeListBegin()

writeListBegin(  $elemType,   $size) 

Parameters

$elemType
$size

writeListEnd()

writeListEnd() 

writeSetBegin()

writeSetBegin(  $elemType,   $size) 

Parameters

$elemType
$size

writeSetEnd()

writeSetEnd() 

writeBool()

writeBool(  $bool) 

Parameters

$bool

writeByte()

writeByte(  $byte) 

Parameters

$byte

writeI16()

writeI16(  $i16) 

Parameters

$i16

writeI32()

writeI32(  $i32) 

Parameters

$i32

writeI64()

writeI64(  $i64) 

Parameters

$i64

writeDouble()

writeDouble(  $dub) 

Parameters

$dub

writeString()

writeString(  $str) 

Parameters

$str

readMessageBegin()

readMessageBegin(string  $name, integer  $type,   $seqid) 

Reads the message header

Parameters

string $name

Function name

integer $type

message type TMessageType::CALL or TMessageType::REPLY

$seqid

readMessageEnd()

readMessageEnd() 

Read the close of message

readStructBegin()

readStructBegin(  $name) 

Parameters

$name

readStructEnd()

readStructEnd() 

readFieldBegin()

readFieldBegin(  $name,   $fieldType,   $fieldId) 

Parameters

$name
$fieldType
$fieldId

readFieldEnd()

readFieldEnd() 

readMapBegin()

readMapBegin(  $keyType,   $valType,   $size) 

Parameters

$keyType
$valType
$size

readMapEnd()

readMapEnd() 

readListBegin()

readListBegin(  $elemType,   $size) 

Parameters

$elemType
$size

readListEnd()

readListEnd() 

readSetBegin()

readSetBegin(  $elemType,   $size) 

Parameters

$elemType
$size

readSetEnd()

readSetEnd() 

readBool()

readBool(  $bool) 

Parameters

$bool

readByte()

readByte(  $byte) 

Parameters

$byte

readI16()

readI16(  $i16) 

Parameters

$i16

readI32()

readI32(  $i32) 

Parameters

$i32

readI64()

readI64(  $i64) 

Parameters

$i64

readDouble()

readDouble(  $dub) 

Parameters

$dub

readString()

readString(  $str) 

Parameters

$str

skip()

skip(\Thrift\Type\TType  $type) 

The skip function is a utility to parse over unrecognized date without causing corruption.

Parameters

\Thrift\Type\TType $type

What type is it

skipBinary()

skipBinary(\Thrift\Protocol\TTransport  $itrans, integer  $type) 

Utility for skipping binary data

Parameters

\Thrift\Protocol\TTransport $itrans

TTransport object

integer $type

Field type

reset()

reset() 

readJSONSyntaxChar()

readJSONSyntaxChar(  $b) 

Parameters

$b

getTypeNameForTypeID()

getTypeNameForTypeID(  $typeID) 

Parameters

$typeID

getTypeIDForTypeName()

getTypeIDForTypeName(  $name) 

Parameters

$name

pushContext()

pushContext(  $c) 

Parameters

$c

popContext()

popContext() 

hexVal()

hexVal(  $s) 

Parameters

$s

hexChar()

hexChar(  $val) 

Parameters

$val

hasJSONUnescapedUnicode()

hasJSONUnescapedUnicode() 

unescapedUnicode()

unescapedUnicode(  $str) 

Parameters

$str

writeJSONString()

writeJSONString(  $b) 

Parameters

$b

writeJSONInteger()

writeJSONInteger(  $num) 

Parameters

$num

writeJSONDouble()

writeJSONDouble(  $num) 

Parameters

$num

writeJSONBase64()

writeJSONBase64(  $data) 

Parameters

$data

writeJSONObjectStart()

writeJSONObjectStart() 

writeJSONObjectEnd()

writeJSONObjectEnd() 

writeJSONArrayStart()

writeJSONArrayStart() 

writeJSONArrayEnd()

writeJSONArrayEnd() 

readJSONString()

readJSONString(  $skipContext) 

Parameters

$skipContext

isJSONNumeric()

isJSONNumeric(  $b) 

Parameters

$b

readJSONNumericChars()

readJSONNumericChars() 

readJSONInteger()

readJSONInteger() 

readJSONIntegerAsString()

readJSONIntegerAsString() 

Identical to readJSONInteger but without the final cast.

Needed for proper handling of i64 on 32 bit machines. Why a separate function? So we don't have to force the rest of the use cases through the extra conditional.

readJSONDouble()

readJSONDouble() 

readJSONBase64()

readJSONBase64() 

readJSONObjectStart()

readJSONObjectStart() 

readJSONObjectEnd()

readJSONObjectEnd() 

readJSONArrayStart()

readJSONArrayStart() 

readJSONArrayEnd()

readJSONArrayEnd()