InputStream_t Class Reference

Generic input stream interface.

#include <UTIOStreams.h>

Inheritance diagram for InputStream_t:
CommandInputStream_t IOStream_t BufferIOStream_t File_t BufferedFile_t

List of all members.

Public Member Functions

virtual ~InputStream_t ()
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

Detailed Description

Definition at line 50 of file UTIOStreams.h.


Constructor & Destructor Documentation

virtual InputStream_t::~InputStream_t (  )  [virtual]

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.


Member Function Documentation

virtual Status_t InputStream_t::Read ( byte buffer,
int  bytes_to_read,
bool  force_read_all = true 
) [pure virtual]

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.

Implemented in BufferedFile_t, CommandInputStream_t, File_t, and BufferIOStream_t.

virtual Status_t InputStream_t::ReadLine ( out String_t line  )  [virtual]

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.

Reimplemented in BufferedFile_t, CommandInputStream_t, and BufferIOStream_t.

virtual Status_t InputStream_t::Peek ( byte buffer,
int  bytes_to_read 
) [virtual]

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.

Reimplemented in CommandInputStream_t, and BufferIOStream_t.

virtual Status_t InputStream_t::Position ( out fileoff_t position  )  [pure virtual]

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.

Implemented in BufferedFile_t, CommandInputStream_t, File_t, IOStream_t, and BufferIOStream_t.

virtual Status_t InputStream_t::Seek ( fileoff_t  position  )  [pure virtual]

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.

Implemented in BufferedFile_t, CommandInputStream_t, File_t, IOStream_t, and BufferIOStream_t.

virtual Status_t InputStream_t::SeekRelative ( fileoff_t  delta  )  [virtual]

Repositions the input stream to the requested position, relative to the current position. Note that not all types of streams support seeking backward. All streams can seek forward, merely by discarding bytes from the stream.

Reimplemented in IOStream_t, and BufferIOStream_t.

virtual Status_t InputStream_t::Close (  )  [pure virtual]

Closes this input stream and releases any resources associated with it.

Implemented in BufferedFile_t, CommandInputStream_t, File_t, IOStream_t, and BufferIOStream_t.


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

Generated on Tue Dec 14 22:35:06 2010 for UT library by  doxygen 1.6.1