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.
Public Functions
Name | |
---|---|
BinaryStreamStack() Initializes a new instance of the BinaryStreamStack class with the default encoding of UTF8. | |
BinaryStreamStack(Encoding encoding) Initializes a new instance of the BinaryStreamStack class. | |
bool | HasData() Returns true if there is any data left to read. |
BinaryReader | Peek() Returns the reader on the top of the stack but does not remove it. |
BinaryReader | Pop() Returns the reader on the top of the stack and removes it. |
void | Push(byte[] data) Pushes data to the front of the stack. The most recently pushed data will be read first. |
void | Push(byte[] data, int offset, int count) Pushes data to the front of the stack. The most recently pushed data will be read first. |
int | Read() Reads a single byte as an integer from the stack. Returns -1 if no data is left to read. |
int | Read(byte[] buffer, int index, int count) Reads the specified number of bytes from the stack, starting from a specified point in the byte array. |
int | Read(char[] buffer, int index, int count) Reads the specified number of characters from the stack, starting from a specified point in the byte array. |
byte[] | ReadByteLine() Reads the specified number of characters from the stack, starting from a specified point in the byte array. |
byte[] | ReadByteLine(out bool hitStreamEnd) Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream. |
string | ReadLine() Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream. |
string | ReadLine(out bool hitStreamEnd) Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream. |
Public Properties
Name | |
---|---|
Encoding | CurrentEncoding Gets or sets the current encoding. |
Public Functions Documentation
function BinaryStreamStack
BinaryStreamStack()
Initializes a new instance of the BinaryStreamStack class with the default encoding of UTF8.
function BinaryStreamStack
BinaryStreamStack(
Encoding encoding
)
Initializes a new instance of the BinaryStreamStack class.
Parameters:
- encoding The encoding to use for character based operations.
function HasData
bool HasData()
Returns true if there is any data left to read.
Return: True or false.
function Peek
BinaryReader Peek()
Returns the reader on the top of the stack but does not remove it.
Return: The BinaryReader.
function Pop
BinaryReader Pop()
Returns the reader on the top of the stack and removes it.
Return: The BinaryReader.
function Push
void Push(
byte[] data
)
Pushes data to the front of the stack. The most recently pushed data will be read first.
Parameters:
- data The data to add to the stack.
function Push
void Push(
byte[] data,
int offset,
int count
)
Pushes data to the front of the stack. The most recently pushed data will be read first.
Parameters:
- data The data to add to the stack.
- offset The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- count The maximum number of bytes to write.
function Read
int Read()
Reads a single byte as an integer from the stack. Returns -1 if no data is left to read.
Return: The byte that was read.
function Read
int Read(
byte[] buffer,
int index,
int count
)
Reads the specified number of bytes from the stack, starting from a specified point in the byte array.
Parameters:
- buffer The buffer to read data into.
- index The index of buffer to start reading into.
- count The number of bytes to read into the buffer.
Return: The number of bytes read into buffer. This might be less than the number of bytes requested if that many bytes are not available, or it might be zero if the end of the stream is reached.
function Read
int Read(
char[] buffer,
int index,
int count
)
Reads the specified number of characters from the stack, starting from a specified point in the byte array.
Parameters:
- buffer The buffer to read data into.
- index The index of buffer to start reading into.
- count The number of characters to read into the buffer.
Return: The number of characters read into buffer. This might be less than the number of bytes requested if that many bytes are not available, or it might be zero if the end of the stream is reached.
function ReadByteLine
byte[] ReadByteLine()
Reads the specified number of characters from the stack, starting from a specified point in the byte array.
Return: A byte array containing all the data up to but not including the next newline in the stack.
function ReadByteLine
byte[] ReadByteLine(
out bool hitStreamEnd
)
Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream.
Parameters:
- hitStreamEnd This will be set to true if we did not end on a newline but instead found the end of our data.
Return: The string containing the line.
function ReadLine
string ReadLine()
Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream.
Return: The string containing the line.
function ReadLine
string ReadLine(
out bool hitStreamEnd
)
Reads a line from the stack delimited by the newline for this platform. The newline characters will not be included in the stream.
Parameters:
- hitStreamEnd This will be set to true if we did not end on a newline but instead found the end of our data.
Return: The string containing the line.
Public Property Documentation
property CurrentEncoding
Encoding CurrentEncoding;
Gets or sets the current encoding.