MapGuide API Reference
 All Classes Functions Variables Enumerations Enumerator Friends
MgByteReader Class Reference

Reads data from a byte source. Once read, the data in the reader cannot be reread. More...

+ Inheritance diagram for MgByteReader:

List of all members.

Public Member Functions

virtual INT64 GetLength ()
 Returns the remaining length of the underlying byte source. This length is adjusted for previous reads. If the returned length is zero then the underlying source may be a streaming format and the length is not known.
STRING GetMimeType ()
 Gets the mime type of the data in this reader. See MgMimeType for list of possible mime types.
bool IsRewindable ()
 Determines if the reader is rewindable.
 MgByteReader (CREFSTRING fileName, CREFSTRING mimeType, bool removeFile)
 Creates a byte reader from a file.
 MgByteReader (CREFSTRING contents, CREFSTRING mimeType)
 Creates a byte reader from a string.
 MgByteReader (BYTE_ARRAY_IN contents, INT32 length, CREFSTRING mimeType)
 Creates a byte reader from an array of bytes.
INT32 Read (BYTE_ARRAY_OUT buffer, INT32 length)
 Reads a buffer.
void Rewind ()
 Rewinds to the start of the reader. Depending on the source of the reader, Rewind may not be supported. Readers sourced from true streams cannot be rewound.
void ToFile (CREFSTRING fileName)
 Writes the the contents of the reader to a file.
STRING ToString ()
 

Friends

class MgByteSink
class MgByteSource

Detailed Description

Reads data from a byte source. Once read, the data in the reader cannot be reread.

Remarks:
Here are a few scenarios to illustrate how MgByteSink, MgByteSource and MgByteReader interact:

Loading the content of a file and creating a byte reader to be passed to a service API:

Receiving a byte reader from a service API and saving the result into a file:
Saving the content of a memory buffer (or of a string) into a file: