C# Класс Flood.Serialization.JSONSerializer

JSON protocol implementation for thrift. This is a full-featured protocol supporting Write and Read. Please see the C++ class header for a detailed description of the protocol's wire format. Adapted from the Java version.
Наследование: Serializer
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
context JSONBaseContext
contextStack Stack
reader LookaheadReader
utf8Encoding System.Text.Encoding

Открытые методы

Метод Описание
JSONSerializer ( System stream ) : System

JSONProtocol Constructor

ReadBinary ( ) : byte[]
ReadBool ( ) : bool
ReadByte ( ) : byte
ReadDataObjectBegin ( ) : DataObject
ReadDataObjectEnd ( ) : void
ReadDouble ( ) : double
ReadFieldBegin ( ) : Field
ReadFieldEnd ( ) : void
ReadI16 ( ) : short
ReadI32 ( ) : int
ReadI64 ( ) : long
ReadListBegin ( ) : TList
ReadListEnd ( ) : void
ReadMapBegin ( ) : TMap
ReadMapEnd ( ) : void
ReadString ( ) : String
WriteBinary ( byte bin ) : void
WriteBool ( bool b ) : void
WriteByte ( byte b ) : void
WriteDataObjectBegin ( DataObject str ) : void
WriteDataObjectEnd ( ) : void
WriteDouble ( double dub ) : void
WriteFieldBegin ( Field 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
WriteString ( String str ) : void

Защищенные методы

Метод Описание
PopContext ( ) : void

Pop the last JSON context off the stack

PushContext ( JSONBaseContext c ) : void

Push a new JSON context onto the stack.

ReadJSONSyntaxChar ( byte b ) : void

Read a byte that must match b[0]; otherwise an exception is thrown. Marked protected to avoid synthetic accessor in JSONListContext.Read and JSONPairContext.Read

Приватные методы

Метод Описание
GetTypeIDForTypeName ( byte name ) : DataType
GetTypeNameForTypeID ( DataType typeID ) : byte[]
HexChar ( byte val ) : byte

Convert a byte containing a hex value to its corresponding hex character

HexVal ( byte ch ) : byte

Convert a byte containing a hex char ('0'-'9' or 'a'-'f') into its corresponding hex value

IsJSONNumeric ( byte b ) : bool

Return true if the given byte could be a valid part of a JSON number.

ReadJSONArrayEnd ( ) : void
ReadJSONArrayStart ( ) : void
ReadJSONBase64 ( ) : byte[]

Read in a JSON string containing base-64 encoded data and decode it.

ReadJSONDouble ( ) : double

Read in a JSON double value. Throw if the value is not wrapped in quotes when expected or if wrapped in quotes when not expected.

ReadJSONInteger ( ) : long

Read in a JSON number. If the context dictates, Read in enclosing quotes.

ReadJSONNumericChars ( ) : String

Read in a sequence of characters that are all valid in JSON numbers. Does not do a complete regex check to validate that this is actually a number.

ReadJSONObjectEnd ( ) : void
ReadJSONObjectStart ( ) : void
ReadJSONString ( bool skipContext ) : byte[]

Read in a JSON string, unescaping as appropriate.. Skip Reading from the context if skipContext is true.

WriteJSONArrayEnd ( ) : void
WriteJSONArrayStart ( ) : void
WriteJSONBase64 ( byte b ) : void

Write out contents of byte array b as a JSON string with base-64 encoded data

WriteJSONDouble ( double num ) : void

Write out a double as a JSON value. If it is NaN or infinity or if the context dictates escaping, Write out as JSON string.

WriteJSONInteger ( long num ) : void

Write out number as a JSON value. If the context dictates so, it will be wrapped in quotes to output as a JSON string.

WriteJSONObjectEnd ( ) : void
WriteJSONObjectStart ( ) : void
WriteJSONString ( byte b ) : void

Write the bytes in array buf as a JSON characters, escaping as needed

Описание методов

JSONSerializer() публичный Метод

JSONProtocol Constructor
public JSONSerializer ( System stream ) : System
stream System
Результат System

PopContext() защищенный Метод

Pop the last JSON context off the stack
protected PopContext ( ) : void
Результат void

PushContext() защищенный Метод

Push a new JSON context onto the stack.
protected PushContext ( JSONBaseContext c ) : void
c JSONBaseContext
Результат void

ReadBinary() публичный Метод

public ReadBinary ( ) : byte[]
Результат byte[]

ReadBool() публичный Метод

public ReadBool ( ) : bool
Результат bool

ReadByte() публичный Метод

public ReadByte ( ) : byte
Результат byte

ReadDataObjectBegin() публичный Метод

public ReadDataObjectBegin ( ) : DataObject
Результат DataObject

ReadDataObjectEnd() публичный Метод

public ReadDataObjectEnd ( ) : void
Результат void

ReadDouble() публичный Метод

public ReadDouble ( ) : double
Результат double

ReadFieldBegin() публичный Метод

public ReadFieldBegin ( ) : Field
Результат Field

ReadFieldEnd() публичный Метод

public ReadFieldEnd ( ) : void
Результат void

ReadI16() публичный Метод

public ReadI16 ( ) : short
Результат short

ReadI32() публичный Метод

public ReadI32 ( ) : int
Результат int

ReadI64() публичный Метод

public ReadI64 ( ) : long
Результат long

ReadJSONSyntaxChar() защищенный Метод

Read a byte that must match b[0]; otherwise an exception is thrown. Marked protected to avoid synthetic accessor in JSONListContext.Read and JSONPairContext.Read
protected ReadJSONSyntaxChar ( byte b ) : void
b byte
Результат void

ReadListBegin() публичный Метод

public ReadListBegin ( ) : TList
Результат TList

ReadListEnd() публичный Метод

public ReadListEnd ( ) : void
Результат void

ReadMapBegin() публичный Метод

public ReadMapBegin ( ) : TMap
Результат TMap

ReadMapEnd() публичный Метод

public ReadMapEnd ( ) : void
Результат void

ReadString() публичный Метод

public ReadString ( ) : String
Результат String

WriteBinary() публичный Метод

public WriteBinary ( byte bin ) : void
bin byte
Результат void

WriteBool() публичный Метод

public WriteBool ( bool b ) : void
b bool
Результат void

WriteByte() публичный Метод

public WriteByte ( byte b ) : void
b byte
Результат void

WriteDataObjectBegin() публичный Метод

public WriteDataObjectBegin ( DataObject str ) : void
str DataObject
Результат void

WriteDataObjectEnd() публичный Метод

public WriteDataObjectEnd ( ) : void
Результат void

WriteDouble() публичный Метод

public WriteDouble ( double dub ) : void
dub double
Результат void

WriteFieldBegin() публичный Метод

public WriteFieldBegin ( Field field ) : void
field Field
Результат void

WriteFieldEnd() публичный Метод

public WriteFieldEnd ( ) : void
Результат void

WriteFieldStop() публичный Метод

public WriteFieldStop ( ) : void
Результат void

WriteI16() публичный Метод

public WriteI16 ( short i16 ) : void
i16 short
Результат void

WriteI32() публичный Метод

public WriteI32 ( int i32 ) : void
i32 int
Результат void

WriteI64() публичный Метод

public WriteI64 ( long i64 ) : void
i64 long
Результат void

WriteListBegin() публичный Метод

public WriteListBegin ( TList list ) : void
list TList
Результат void

WriteListEnd() публичный Метод

public WriteListEnd ( ) : void
Результат void

WriteMapBegin() публичный Метод

public WriteMapBegin ( TMap map ) : void
map TMap
Результат void

WriteMapEnd() публичный Метод

public WriteMapEnd ( ) : void
Результат void

WriteString() публичный Метод

public WriteString ( String str ) : void
str String
Результат void

Описание свойств

context защищенное свойство

protected JSONBaseContext context
Результат JSONBaseContext

contextStack защищенное свойство

protected Stack contextStack
Результат Stack

reader защищенное свойство

protected LookaheadReader reader
Результат LookaheadReader

utf8Encoding защищенное свойство

protected Encoding,System.Text utf8Encoding
Результат System.Text.Encoding