Avro C#
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
Avro.IO.JsonDecoder Class Reference

A Decoder for Avro's JSON data encoding. More...

Inheritance diagram for Avro.IO.JsonDecoder:
Avro.IO.ParsingDecoder Avro.IO.Decoder Avro.IO.Parsing.Parser.IActionHandler Avro.IO.Parsing.SkipParser.ISkipHandler

Public Member Functions

 JsonDecoder (Schema schema, Stream stream)
 Initializes a new instance of the JsonDecoder class.
 
 JsonDecoder (Schema schema, string str)
 Initializes a new instance of the JsonDecoder class.
 
void Configure (Stream stream)
 Reconfigures this JsonDecoder to use the InputStream provided. Otherwise, this JsonDecoder will reset its state and then reconfigure its input.
 
void Configure (string str)
 Reconfigures this JsonDecoder to use the String provided for input. Otherwise, this JsonDecoder will reset its state and then reconfigure its input.
 
override void ReadNull ()
 Reads a null Avro type.
 
override bool ReadBoolean ()
 Read a boolean Avro type.
Returns
The boolean just read

 
override int ReadInt ()
 Reads an int Avro type.
Returns
The int just read

 
override long ReadLong ()
 Reads a long Avro type.
Returns
The long just read

 
override float ReadFloat ()
 Reads a float Avro type.
Returns
The float just read

 
override double ReadDouble ()
 Reads a double Avro type.
Returns
The double just read

 
override string ReadString ()
 Reads a string Avro type.
Returns
The string just read

 
override void SkipString ()
 Skips a string Avro type on the stream.
 
override byte[] ReadBytes ()
 Reads the bytes Avro type.
Returns
The bytes just read

 
override void SkipBytes ()
 Skips a bytes Avro type on the stream.
 
override void ReadFixed (byte[] bytes)
 A convenience method for ReadFixed(buffer, 0, buffer.Length);.
Parameters
bufferThe buffer to read into.

 
override void ReadFixed (byte[] bytes, int start, int len)
 Read a Fixed Avro type of length.
Parameters
bufferBuffer to read into
startStarting position of buffer to read into
lengthNumber of bytes to read

 
override void SkipFixed (int length)
 Skips a fixed of a specified length.
Parameters
lenLength of the fixed.

 
override int ReadEnum ()
 Reads an enum AvroType.
Returns
The enum just read

 
override long ReadArrayStart ()
 Starts reading the array Avro type. This, together with ReadArrayNext() is used to read the items from Avro array. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadArrayNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array.for (int n = decoder.ReadArrayStart(); n > 0; n = decoder.ReadArrayNext()) { // Read one array entry. }
Returns
The number of entries in the initial chunk, 0 if the array is empty.

 
override long ReadArrayNext ()
 See ReadArrayStart().
Returns
The number of array entries in the next chunk, 0 if there are no more entries.

 
override void SkipArray ()
 
override long ReadMapStart ()
 Starts reading the map Avro type. This, together with ReadMapNext() is used to read the entries from Avro map. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadMapNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array. for (int n = decoder.ReadMapStart(); n > 0; n = decoder.ReadMapNext()) { // Read one map entry. }.
Returns
The number of entries in the initial chunk, 0 if the map is empty.

 
override long ReadMapNext ()
 See ReadMapStart().
Returns
The number of map entries in the next chunk, 0 if there are no more entries.

 
override void SkipMap ()
 
override int ReadUnionIndex ()
 Reads the index, which determines the type in an union Avro type.
Returns
The index of the type within the union.

 
override void SkipNull ()
 Skips a null Avro type on the stream.
 
override void SkipBoolean ()
 Skips a boolean Avro type on the stream.
 
override void SkipInt ()
 Skips a int Avro type on the stream.
 
override void SkipLong ()
 Skips a long Avro type on the stream.
 
override void SkipFloat ()
 Skips a float Avro type on the stream.
 
override void SkipDouble ()
 Skips a double Avro type on the stream.
 
override void SkipEnum ()
 Skips an enumeration.
 
override void SkipUnionIndex ()
 Skips a union tag index.
 
override Symbol DoAction (Symbol input, Symbol top)
 Handle the action symbol top when the input is sought to be taken off the stack.
Parameters
inputThe input symbol from the caller of Advance
topThe symbol at the top the stack.
Returns
null if Advance() is to continue processing the stack. If not null the return value will be returned by Advance().

 
- Public Member Functions inherited from Avro.IO.ParsingDecoder
void ReadNull ()
 Reads a null Avro type.
 
bool ReadBoolean ()
 Read a boolean Avro type.
Returns
The boolean just read

 
int ReadInt ()
 Reads an int Avro type.
Returns
The int just read

 
long ReadLong ()
 Reads a long Avro type.
Returns
The long just read

 
float ReadFloat ()
 Reads a float Avro type.
Returns
The float just read

 
double ReadDouble ()
 Reads a double Avro type.
Returns
The double just read

 
byte[] ReadBytes ()
 Reads the bytes Avro type.
Returns
The bytes just read

 
string ReadString ()
 Reads a string Avro type.
Returns
The string just read

 
int ReadEnum ()
 Reads an enum AvroType.
Returns
The enum just read

 
long ReadArrayStart ()
 Starts reading the array Avro type. This, together with ReadArrayNext() is used to read the items from Avro array. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadArrayNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array.for (int n = decoder.ReadArrayStart(); n > 0; n = decoder.ReadArrayNext()) { // Read one array entry. }
Returns
The number of entries in the initial chunk, 0 if the array is empty.

 
long ReadArrayNext ()
 See ReadArrayStart().
Returns
The number of array entries in the next chunk, 0 if there are no more entries.

 
long ReadMapStart ()
 Starts reading the map Avro type. This, together with ReadMapNext() is used to read the entries from Avro map. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadMapNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array. for (int n = decoder.ReadMapStart(); n > 0; n = decoder.ReadMapNext()) { // Read one map entry. }.
Returns
The number of entries in the initial chunk, 0 if the map is empty.

 
long ReadMapNext ()
 See ReadMapStart().
Returns
The number of map entries in the next chunk, 0 if there are no more entries.

 
int ReadUnionIndex ()
 Reads the index, which determines the type in an union Avro type.
Returns
The index of the type within the union.

 
void ReadFixed (byte[] buffer)
 A convenience method for ReadFixed(buffer, 0, buffer.Length);.
Parameters
bufferThe buffer to read into.

 
void ReadFixed (byte[] buffer, int start, int length)
 Read a Fixed Avro type of length.
Parameters
bufferBuffer to read into
startStarting position of buffer to read into
lengthNumber of bytes to read

 
void SkipNull ()
 Skips a null Avro type on the stream.
 
void SkipBoolean ()
 Skips a boolean Avro type on the stream.
 
void SkipInt ()
 Skips a int Avro type on the stream.
 
void SkipLong ()
 Skips a long Avro type on the stream.
 
void SkipFloat ()
 Skips a float Avro type on the stream.
 
void SkipDouble ()
 Skips a double Avro type on the stream.
 
void SkipBytes ()
 Skips a bytes Avro type on the stream.
 
void SkipString ()
 Skips a string Avro type on the stream.
 
void SkipEnum ()
 Skips an enumeration.
 
void SkipUnionIndex ()
 Skips a union tag index.
 
void SkipFixed (int len)
 Skips a fixed of a specified length.
Parameters
lenLength of the fixed.

 
void SkipArray ()
 Skips an array on the stream.
 
void SkipMap ()
 Skips a map on the stream.
 
Symbol DoAction (Symbol input, Symbol top)
 Handle the action symbol top when the input is sought to be taken off the stack.
Parameters
inputThe input symbol from the caller of Advance
topThe symbol at the top the stack.
Returns
null if Advance() is to continue processing the stack. If not null the return value will be returned by Advance().

 
virtual void SkipAction ()
 Skips the action at the top of the stack.
 
virtual void SkipTopSymbol ()
 Skips the symbol at the top of the stack.
 

Protected Member Functions

override void SkipFixed ()
 
- Protected Member Functions inherited from Avro.IO.ParsingDecoder
 ParsingDecoder (Symbol root)
 Initializes a new instance of the ParsingDecoder class.
 
void SkipFixed ()
 Skips a fixed type on the stream.
 

Additional Inherited Members

- Protected Attributes inherited from Avro.IO.ParsingDecoder
readonly SkipParser Parser
 The parser.
 

Detailed Description

A Decoder for Avro's JSON data encoding.

JsonDecoder is not thread-safe.

Member Function Documentation

◆ Configure() [1/2]

void Avro.IO.JsonDecoder.Configure ( Stream  stream)
inline

Reconfigures this JsonDecoder to use the InputStream provided. Otherwise, this JsonDecoder will reset its state and then reconfigure its input.

Parameters
streamThe InputStream to read from. Cannot be null.

◆ Configure() [2/2]

void Avro.IO.JsonDecoder.Configure ( string  str)
inline

Reconfigures this JsonDecoder to use the String provided for input. Otherwise, this JsonDecoder will reset its state and then reconfigure its input.

Parameters
strThe String to read from. Cannot be null.

◆ DoAction()

override Symbol Avro.IO.JsonDecoder.DoAction ( Symbol  input,
Symbol  top 
)
inline

Handle the action symbol top when the input is sought to be taken off the stack.

Parameters
inputThe input symbol from the caller of Advance
topThe symbol at the top the stack.
Returns
null if Advance() is to continue processing the stack. If not null the return value will be returned by Advance().

Implements Avro.IO.Parsing.Parser.IActionHandler.

◆ ReadArrayNext()

override long Avro.IO.JsonDecoder.ReadArrayNext ( )
inline

See ReadArrayStart().

Returns
The number of array entries in the next chunk, 0 if there are no more entries.

Implements Avro.IO.Decoder.

◆ ReadArrayStart()

override long Avro.IO.JsonDecoder.ReadArrayStart ( )
inline

Starts reading the array Avro type. This, together with ReadArrayNext() is used to read the items from Avro array. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadArrayNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array.for (int n = decoder.ReadArrayStart(); n > 0; n = decoder.ReadArrayNext()) { // Read one array entry. }

Returns
The number of entries in the initial chunk, 0 if the array is empty.

Implements Avro.IO.Decoder.

◆ ReadBoolean()

override bool Avro.IO.JsonDecoder.ReadBoolean ( )
inline

Read a boolean Avro type.

Returns
The boolean just read

Implements Avro.IO.Decoder.

◆ ReadBytes()

override byte[] Avro.IO.JsonDecoder.ReadBytes ( )
inline

Reads the bytes Avro type.

Returns
The bytes just read

Implements Avro.IO.Decoder.

◆ ReadDouble()

override double Avro.IO.JsonDecoder.ReadDouble ( )
inline

Reads a double Avro type.

Returns
The double just read

Implements Avro.IO.Decoder.

◆ ReadEnum()

override int Avro.IO.JsonDecoder.ReadEnum ( )
inline

Reads an enum AvroType.

Returns
The enum just read

Implements Avro.IO.Decoder.

◆ ReadFixed() [1/2]

override void Avro.IO.JsonDecoder.ReadFixed ( byte[]  bytes)
inline

A convenience method for ReadFixed(buffer, 0, buffer.Length);.

Parameters
bufferThe buffer to read into.

Implements Avro.IO.Decoder.

◆ ReadFixed() [2/2]

override void Avro.IO.JsonDecoder.ReadFixed ( byte[]  bytes,
int  start,
int  len 
)
inline

Read a Fixed Avro type of length.

Parameters
bufferBuffer to read into
startStarting position of buffer to read into
lengthNumber of bytes to read

Implements Avro.IO.Decoder.

◆ ReadFloat()

override float Avro.IO.JsonDecoder.ReadFloat ( )
inline

Reads a float Avro type.

Returns
The float just read

Implements Avro.IO.Decoder.

◆ ReadInt()

override int Avro.IO.JsonDecoder.ReadInt ( )
inline

Reads an int Avro type.

Returns
The int just read

Implements Avro.IO.Decoder.

◆ ReadLong()

override long Avro.IO.JsonDecoder.ReadLong ( )
inline

Reads a long Avro type.

Returns
The long just read

Implements Avro.IO.Decoder.

◆ ReadMapNext()

override long Avro.IO.JsonDecoder.ReadMapNext ( )
inline

See ReadMapStart().

Returns
The number of map entries in the next chunk, 0 if there are no more entries.

Implements Avro.IO.Decoder.

◆ ReadMapStart()

override long Avro.IO.JsonDecoder.ReadMapStart ( )
inline

Starts reading the map Avro type. This, together with ReadMapNext() is used to read the entries from Avro map. This returns the number of entries in the initial chunk. After consuming the chunk, the client should call ReadMapNext() to get the number of entries in the next chunk. The client should repeat the procedure until there are no more entries in the array. for (int n = decoder.ReadMapStart(); n > 0; n = decoder.ReadMapNext()) { // Read one map entry. }.

Returns
The number of entries in the initial chunk, 0 if the map is empty.

Implements Avro.IO.Decoder.

◆ ReadNull()

override void Avro.IO.JsonDecoder.ReadNull ( )
inline

Reads a null Avro type.

Implements Avro.IO.Decoder.

◆ ReadString()

override string Avro.IO.JsonDecoder.ReadString ( )
inline

Reads a string Avro type.

Returns
The string just read

Implements Avro.IO.Decoder.

◆ ReadUnionIndex()

override int Avro.IO.JsonDecoder.ReadUnionIndex ( )
inline

Reads the index, which determines the type in an union Avro type.

Returns
The index of the type within the union.

Implements Avro.IO.Decoder.

◆ SkipBoolean()

override void Avro.IO.JsonDecoder.SkipBoolean ( )
inline

Skips a boolean Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipBytes()

override void Avro.IO.JsonDecoder.SkipBytes ( )
inline

Skips a bytes Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipDouble()

override void Avro.IO.JsonDecoder.SkipDouble ( )
inline

Skips a double Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipEnum()

override void Avro.IO.JsonDecoder.SkipEnum ( )
inline

Skips an enumeration.

Implements Avro.IO.Decoder.

◆ SkipFixed()

override void Avro.IO.JsonDecoder.SkipFixed ( int  length)
inline

Skips a fixed of a specified length.

Parameters
lenLength of the fixed.

Implements Avro.IO.Decoder.

◆ SkipFloat()

override void Avro.IO.JsonDecoder.SkipFloat ( )
inline

Skips a float Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipInt()

override void Avro.IO.JsonDecoder.SkipInt ( )
inline

Skips a int Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipLong()

override void Avro.IO.JsonDecoder.SkipLong ( )
inline

Skips a long Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipNull()

override void Avro.IO.JsonDecoder.SkipNull ( )
inline

Skips a null Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipString()

override void Avro.IO.JsonDecoder.SkipString ( )
inline

Skips a string Avro type on the stream.

Implements Avro.IO.Decoder.

◆ SkipUnionIndex()

override void Avro.IO.JsonDecoder.SkipUnionIndex ( )
inline

Skips a union tag index.

Implements Avro.IO.Decoder.


The documentation for this class was generated from the following file: