MrSID Decode SDK for Raster Reference Manual 9.5.4.4709

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Types | Protected Attributes | List of all members
LTIOFileStream Class Reference

File stream. More...

`#include <lt_ioFileStream.h>`

Inheritance diagram for LTIOFileStream:
[legend]
Collaboration diagram for LTIOFileStream:
[legend]

## Public Member Functions
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 LTIOStreamInf * | duplicate ()
| 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...
int | stdio_setvbuf (lt_uint8 *buf, lt_uint32 mode, lt_uint32 size)
| Set buffering - may be called only after open() but before the first read/write operation. More...
Construction, destruction, initialization
| LTIOFileStream (void)
| Default Constructor. More...
virtual | ~LTIOFileStream (void)
| Destructor. More...
virtual LT_STATUS | initialize (const LTFileSpec &fs, const char *mode)
| Initializes the stream from a file spec. More...
LT_STATUS | initialize (const char *path, const char *mode)
| Default Constructor. More...
Status accessors
int | stdio_ferror ()
| Returns underlying stdio error code. More...
void | stdio_clearerr ()
| Clears underlying stdio error code. More...
Public Member Functions inherited from LTIOStreamInf
virtual | ~LTIOStreamInf ()=0
virtual char * | readString (int delimiter= '\0')
| read a delimiter-terminated string More...

## Protected Types
enum | { unknown_state = 1, reading_state = 2, writing_state = 3 }

## Protected Attributes
FILE * | m_file
enum LTIOFileStream:: { ... } | m_state
LTFileSpec | m_path
char * | m_mode
char * | m_uri

## Detailed Description

This class implements a file-based stream.

Examples:
  DerivedImageReader.cpp, and UsingStreams.cpp.

Definition at line 33 of file lt_ioFileStream.h.

## Member Enumeration Documentation

anonymous enum
| protected

Enumerator
unknown_state |
reading_state |
writing_state |

Definition at line 114 of file lt_ioFileStream.h.

## Constructor & Destructor Documentation

LTIOFileStream::LTIOFileStream | ( | void | ) |  |

virtual LTIOFileStream::~LTIOFileStream | ( | void | ) |  |
| virtual

## Member Function Documentation

virtual LT_STATUS LTIOFileStream::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_Success | On success, or if the stream is already closed.
  LT_STS_Failure | Otherwise.

Implements LTIOStreamInf.

Examples:
  UsingStreams.cpp.

virtual LTIOStreamInf* LTIOFileStream::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

  NULL | the stream could not be duplicated; valid LTIOStreamInf* otherwise.

Implements LTIOStreamInf.

virtual const char* LTIOFileStream::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

  uri | the uri string

Implements LTIOStreamInf.

virtual LT_STATUS LTIOFileStream::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

  status | the error code

Implements LTIOStreamInf.

virtual LT_STATUS LTIOFileStream::initialize | ( | const LTFileSpec & | fs,
|  | const char * | mode
| ) |  |
| virtual

Parameters

  fs | file spec
  mode | mode (see stdio.h)

Examples:
  DerivedImageReader.cpp, and UsingStreams.cpp.

LT_STATUS LTIOFileStream::initialize | ( | const char * | path,
|  | const char * | mode
| ) |  |

virtual bool LTIOFileStream::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

  true | end of stream
  false | otherwise

Implements LTIOStreamInf.

virtual bool LTIOFileStream::isOpen | ( | ) |  |
| virtual

Return values

  true | The stream is open
  false | otherwise

Implements LTIOStreamInf.

virtual LT_STATUS LTIOFileStream::open | ( | ) |  |
| virtual

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

Return values

  LT_STS_IOStreamUninitialized | The stream has not been initialized with enough information to open the stream
  LT_STS_IOStreamInvalidState | The stream is already open
  LT_STS_Success | On success.
  LT_STS_Failure | Failure.
  other | Implementations may return other codes

Implements LTIOStreamInf.

Examples:
  UsingStreams.cpp.

virtual lt_uint32 LTIOFileStream::read | ( | lt_uint8 * | pDest,
|  | lt_uint32 | numBytes
| ) |  |
| virtual

Parameters

  pDest | buffer in which to store read data
  numBytes | number of bytes to read from stream

Return values

  numBytes | The number of bytes actually read

Implements LTIOStreamInf.

Examples:
  UsingStreams.cpp.

virtual LT_STATUS LTIOFileStream::seek | ( | lt_int64 | offset,
|  | LTIOSeekDir | origin
| ) |  |
| virtual

Parameters

  offset | number of bytes from origin at which to the next read or write will take place
  origin | place in stream from which to seek

Return values

  LT_STS_IOStreamUnsupported | The stream is not seekable
  LT_STS_IOStreamInvalidArgs | The offset and origin do not specify a valid location in the stream
  LT_STS_Success | On success
  LT_STS_Failure | Otherwise
  other | Implementations may return other codes

Implements LTIOStreamInf.

Examples:
  UsingStreams.cpp.

void LTIOFileStream::stdio_clearerr | ( | ) |  |

int LTIOFileStream::stdio_ferror | ( | ) |  |

int LTIOFileStream::stdio_setvbuf | ( | lt_uint8 * | buf,
|  | lt_uint32 | mode,
|  | lt_uint32 | size
| ) |  |

Parameters

  buf | buffer to use; if NULL then one is allocated
  mode | one of the following: _IONBF (unbuffered) _IOLBF (line buffered) _IOFBF (fully buffered)
  size | size of buffer

virtual lt_int64 LTIOFileStream::tell | ( | ) |  |
| virtual

Return values

  postion | Number of bytes from the start of the data
  -1 | On error.
  other | Implementations may return other codes

Implements LTIOStreamInf.

Examples:
  UsingStreams.cpp.

virtual lt_uint32 LTIOFileStream::write | ( | const lt_uint8 * | pSrc,
|  | lt_uint32 | numBytes
| ) |  |
| virtual

Parameters

  pSrc | buffer from which to store data
  numBytes | number of bytes to write to stream

Return values

  numBytes | number of bytes actually written

Implements LTIOStreamInf.

## Member Data Documentation

FILE* LTIOFileStream::m_file
| protected

Definition at line 111 of file lt_ioFileStream.h.

char* LTIOFileStream::m_mode
| protected

Definition at line 122 of file lt_ioFileStream.h.

LTFileSpec LTIOFileStream::m_path
| protected

Definition at line 121 of file lt_ioFileStream.h.

enum { ... } LTIOFileStream::m_state

char* LTIOFileStream::m_uri
| protected

Definition at line 123 of file lt_ioFileStream.h.

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

- lt_ioFileStream.h

LizardTech