Generic input stream interface.
Public Member Functions
|virtual Status_t||Read (byte *buffer, int bytes_to_read, bool force_read_all=true)=0|
|virtual Status_t||ReadLine (out String_t *line)|
|virtual Status_t||Peek (byte *buffer, int bytes_to_read)|
|virtual Status_t||Position (out fileoff_t *position)=0|
|virtual Status_t||Seek (fileoff_t position)=0|
|virtual Status_t||SeekRelative (fileoff_t delta)|
|virtual Status_t||Close ()=0|
Pure virtual destructor, used exclusively to allow an input stream to be deleted by the owner of a pointer merely to InputStream_t. Unless an error had occurred previously, an input stream must be closed before deleting it.
|virtual Status_t InputStream_t::Read||(||byte *||buffer,|
|bool|| force_read_all = |
Reads up to bytes_to_read bytes into buffer, and returns the number of bytes read as a success status indication, or an error status.
For nonblocking streams, if force_read_all is true, Read will block until all data is read.
If force_read_all is true, a returned byte count less than bytes_to_read indicates that the end of the stream was reached.
If the end of the stream is reached with no data having been read, the returned status will be eERR_end_of_file.
Some InputStream_t subclasses can implement nonblocking I/O, for which the request will proceed to completion asynchronously. If force_read_all is false, such classes return eERR_async_io_in_progress to indicate that data is not currently available, in which case the next call to Read must exactly match the one which returned eERR_async_io_in_progress, and the buffer must remain valid until the next call. Also in that case, no other stream operations are permissible until the previous request has been repeated and succeeded.
Reads a line from the input stream. The line will end when "\r", "\n", "\r\n", "\0", or the end of the stream is encountered. The returned line string will not contain the terminator. If the end of the stream is reached with no line having been read, ReadLine returns eERR_end_of_file. This function will probably be heinously inefficient unless the actual input stream instance provides an optimized version tailored to the type of stream. The base class function depends on the actual input stream class to support seeking backward.
Reads up to bytes_to_read bytes into buffer, and returns the number of bytes read as a success status indication, or an error status. Unlike the Read function, the current position is unaffected, and the same data would be returned by a subsequent call to Peek or Read. Not all input streams support peeking. The base class function depends on the actual input stream class to support seeking backward.
Returns the position in the input stream through the position output parameter unless an error occurs, in which case an error status is returned in the Status_t return value. For streams of infinite length with a signed fileoff_t type on the target platform, negative values are legitimate, with the largest negative value representing wraparound from the largest positive value.
Repositions the input stream to the requested position. Note that not all types of streams support seeking backward. All streams can seek forward, merely by discarding bytes from the stream. For streams of infinite length with a signed fileoff_t type on the target platform, negative values are legitimate, with the largest negative value representing wraparound from the largest positive value.
|virtual Status_t InputStream_t::Close||(||)||