MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
LTIOBufferedStream Class Reference

Stream which wraps an array of bytes in memory. More...

#include <lt_ioBufferedStream.h>

Inheritance diagram for LTIOBufferedStream:
Collaboration diagram for LTIOBufferedStream:

Public Member Functions

 LTIOBufferedStream ()
 
virtual ~LTIOBufferedStream ()
 
virtual LT_STATUS initialize (LTIOStreamInf *src, lt_uint32 pageSize=1024, lt_uint32 numPages=10, const char *tempDir=0L)
 Initializes the stream. More...
 
virtual bool isEOF ()
 Test for end-of-stream. More...
 
virtual bool isOpen ()
 Test for stream openness. More...
 
virtual LT_STATUS open ()
 Opens the stream. More...
 
virtual LT_STATUS close ()
 Closes the stream. More...
 
virtual lt_uint32 read (lt_uint8 *pDest, lt_uint32 numBytes)
 Retrieve the specified number of bytes from the data source and place them in pDest. More...
 
virtual lt_uint32 write (const lt_uint8 *pSrc, lt_uint32 numBytes)
 Store the specified number of bytes in the data source. More...
 
virtual LT_STATUS seek (lt_int64 offset, LTIOSeekDir origin)
 Moves the data access position to origin + offset. More...
 
virtual lt_int64 tell ()
 Returns the current data access position as an offset from the start of the data. More...
 
virtual LTIOStreamInfduplicate ()
 Clone the stream. More...
 
virtual LT_STATUS getLastError () const
 Get status code of last error event. More...
 
virtual const char * getID () const
 Get a URI describing the stream object. More...
 
- Public Member Functions inherited from LTIOStreamInf
virtual ~LTIOStreamInf ()=0
 

Protected Attributes

lt_uint32 m_pageSize
 
lt_uint32 m_numPages
 
LTIOBufPageCache * m_buffer
 
LTIOStreamInfm_src
 
lt_uint64 m_cur
 
bool m_eof
 
char * m_tempDir
 

Detailed Description

The buffer is of a fixed size and does not grow or shrink.

Definition at line 28 of file lt_ioBufferedStream.h.

Constructor & Destructor Documentation

LTIOBufferedStream::LTIOBufferedStream ( )
virtual LTIOBufferedStream::~LTIOBufferedStream ( )
virtual

Member Function Documentation

virtual LT_STATUS LTIOBufferedStream::close ( )
virtual

Puts the stream in a state that does not allow data access. May free up resources, but only in such a way that doesn't inhibit successful future calls to open()

Return values
LT_STS_SuccessOn success, or if the stream is already closed.
LT_STS_FailureOtherwise.

Implements LTIOStreamInf.

virtual LTIOStreamInf* LTIOBufferedStream::duplicate ( )
virtual

Create new stream of the same type with the same initialization parameters. The transmission of these parameters is the responsibility of the derived type. The new stream should initially return false for isOpen().

Return values
NULLthe stream could not be duplicated; valid LTIOStreamInf* otherwise.

Implements LTIOStreamInf.

virtual const char* LTIOBufferedStream::getID ( ) const
virtual

This function returns a UTF-8, null-terminated string which is a URI describing the origin of the stream object – for example, "file://foo.txt" or "lt_memstream:". This string is only intended for diagnostic purposes, i.e. it may not be valid to pass it to the ctor in an attempt to reopen the stream.

Return values
urithe uri string

Implements LTIOStreamInf.

virtual LT_STATUS LTIOBufferedStream::getLastError ( ) const
virtual

read(), write(), tell(), and duplicate() do not explicitly return status codes in the event of an error. When an error has occurred, this function returns the appropriate status code. Note calling this function after a successful I/O operation will return an undefined value.

Return values
statusthe error code

Implements LTIOStreamInf.

virtual LT_STATUS LTIOBufferedStream::initialize ( LTIOStreamInf src,
lt_uint32  pageSize = 1024,
lt_uint32  numPages = 10,
const char *  tempDir = 0L 
)
virtual
Parameters
srcsource stream; this instance takes ownership of it
pageSizesize of each page in bytes
numPagesnumber of pages to keep cached in memory
tempDirtemp directory to store unused pages; this instance does not clean them up
virtual bool LTIOBufferedStream::isEOF ( )
virtual

Returns true after the first read operation that attempts to read past the end of the stream. It returns false if the current position is not end of stream.

Return values
trueend of stream
falseotherwise

Implements LTIOStreamInf.

virtual bool LTIOBufferedStream::isOpen ( )
virtual
Return values
trueThe stream is open
falseotherwise

Implements LTIOStreamInf.

virtual LT_STATUS LTIOBufferedStream::open ( )
virtual

Opening a stream puts it in a state that allows data access based on cached initialization parameters.

Return values
LT_STS_IOStreamUninitializedThe stream has not been initialized with enough information to open the stream
LT_STS_IOStreamInvalidStateThe stream is already open
LT_STS_SuccessOn success.
LT_STS_FailureFailure.
otherImplementations may return other codes

Implements LTIOStreamInf.

virtual lt_uint32 LTIOBufferedStream::read ( lt_uint8 pDest,
lt_uint32  numBytes 
)
virtual
Parameters
pDestbuffer in which to store read data
numBytesnumber of bytes to read from stream
Return values
numBytesThe number of bytes actually read

Implements LTIOStreamInf.

virtual LT_STATUS LTIOBufferedStream::seek ( lt_int64  offset,
LTIOSeekDir  origin 
)
virtual
Parameters
offsetnumber of bytes from origin at which to the next read or write will take place
originplace in stream from which to seek
Return values
LT_STS_IOStreamUnsupportedThe stream is not seekable
LT_STS_IOStreamInvalidArgsThe offset and origin do not specify a valid location in the stream
LT_STS_SuccessOn success
LT_STS_FailureOtherwise
otherImplementations may return other codes

Implements LTIOStreamInf.

virtual lt_int64 LTIOBufferedStream::tell ( )
virtual
Return values
postionNumber of bytes from the start of the data
-1On error.
otherImplementations may return other codes

Implements LTIOStreamInf.

virtual lt_uint32 LTIOBufferedStream::write ( const lt_uint8 pSrc,
lt_uint32  numBytes 
)
virtual
Parameters
pSrcbuffer from which to store data
numBytesnumber of bytes to write to stream
Return values
numBytesnumber of bytes actually written

Implements LTIOStreamInf.

Member Data Documentation

LTIOBufPageCache* LTIOBufferedStream::m_buffer
protected

Definition at line 67 of file lt_ioBufferedStream.h.

lt_uint64 LTIOBufferedStream::m_cur
protected

Definition at line 69 of file lt_ioBufferedStream.h.

bool LTIOBufferedStream::m_eof
protected

Definition at line 70 of file lt_ioBufferedStream.h.

lt_uint32 LTIOBufferedStream::m_numPages
protected

Definition at line 66 of file lt_ioBufferedStream.h.

lt_uint32 LTIOBufferedStream::m_pageSize
protected

Definition at line 65 of file lt_ioBufferedStream.h.

LTIOStreamInf* LTIOBufferedStream::m_src
protected

Definition at line 68 of file lt_ioBufferedStream.h.

char* LTIOBufferedStream::m_tempDir
protected

Definition at line 71 of file lt_ioBufferedStream.h.


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

LizardTech