C# Class HttpMultipartParser.BinaryStreamStack

Provides character based and byte based stream-like read operations over multiple streams and provides methods to add data to the front of the buffer.
Exibir arquivo Open project: Vodurden/Http-Multipart-Data-Parser Class Usage Examples

Public Methods

Method Description
BinaryStreamStack ( ) : System.Collections.Generic

Initializes a new instance of the BinaryStreamStack class with the default encoding of UTF8.

BinaryStreamStack ( Encoding encoding ) : System.Collections.Generic

Initializes a new instance of the BinaryStreamStack class.

HasData ( ) : bool

Returns true if there is any data left to read.

Peek ( ) : BinaryReader

Returns the reader on the top of the stack but does not remove it.

Pop ( ) : BinaryReader

Returns the reader on the top of the stack and removes it

Push ( byte data ) : void

Pushes data to the front of the stack. The most recently pushed data will be read first.

Read ( ) : int

Reads a single byte as an integer from the stack. Returns -1 if no data is left to read.

Read ( byte buffer, int index, int count ) : int

Reads the specified number of bytes from the stack, starting from a specified point in the byte array.

Read ( char buffer, int index, int count ) : int

Reads the specified number of characters from the stack, starting from a specified point in the byte array.

ReadByteLine ( ) : byte[]

Reads the specified number of characters from the stack, starting from a specified point in the byte array.

ReadByteLine ( bool &hitStreamEnd ) : byte[]

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream

ReadLine ( ) : string

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream

ReadLine ( bool &hitStreamEnd ) : string

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream

Private Methods

Method Description
NextStream ( ) : BinaryReader

Removes the current reader from the stack and ensures it is correctly destroyed and then returns the next available reader. If no reader is available this method returns null.

Method Details

BinaryStreamStack() public method

Initializes a new instance of the BinaryStreamStack class with the default encoding of UTF8.
public BinaryStreamStack ( ) : System.Collections.Generic
return System.Collections.Generic

BinaryStreamStack() public method

Initializes a new instance of the BinaryStreamStack class.
public BinaryStreamStack ( Encoding encoding ) : System.Collections.Generic
encoding System.Text.Encoding /// The encoding to use for character based operations. ///
return System.Collections.Generic

HasData() public method

Returns true if there is any data left to read.
public HasData ( ) : bool
return bool

Peek() public method

Returns the reader on the top of the stack but does not remove it.
public Peek ( ) : BinaryReader
return System.IO.BinaryReader

Pop() public method

Returns the reader on the top of the stack and removes it
public Pop ( ) : BinaryReader
return System.IO.BinaryReader

Push() public method

Pushes data to the front of the stack. The most recently pushed data will be read first.
public Push ( byte data ) : void
data byte /// The data to add to the stack. ///
return void

Read() public method

Reads a single byte as an integer from the stack. Returns -1 if no data is left to read.
public Read ( ) : int
return int

Read() public method

Reads the specified number of bytes from the stack, starting from a specified point in the byte array.
public Read ( byte buffer, int index, int count ) : int
buffer byte /// The buffer to read data into. ///
index int /// The index of buffer to start reading into. ///
count int /// The number of bytes to read into the buffer. ///
return int

Read() public method

Reads the specified number of characters from the stack, starting from a specified point in the byte array.
public Read ( char buffer, int index, int count ) : int
buffer char /// The buffer to read data into. ///
index int /// The index of buffer to start reading into. ///
count int /// The number of characters to read into the buffer. ///
return int

ReadByteLine() public method

Reads the specified number of characters from the stack, starting from a specified point in the byte array.
public ReadByteLine ( ) : byte[]
return byte[]

ReadByteLine() public method

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream
public ReadByteLine ( bool &hitStreamEnd ) : byte[]
hitStreamEnd bool /// This will be set to true if we did not end on a newline but instead found the end of /// our data. ///
return byte[]

ReadLine() public method

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream
public ReadLine ( ) : string
return string

ReadLine() public method

Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream
public ReadLine ( bool &hitStreamEnd ) : string
hitStreamEnd bool /// This will be set to true if we did not end on a newline but instead found the end of /// our data. ///
return string