FDO API Reference Feature Data Objects
Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

FdoIoStream Class Reference

#include <Stream.h>

Inherits FdoDisposable.

Inherited by FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

Inheritance diagram for FdoIoStream:

[legend]
List of all members.

Detailed Description

FdoIoStream defines the interface for all FDO streams. Streamed I/O support for various locations, such as files, memory, etc. can be provided by classes that implement this interface.

Note:
There is no function provided to close a FdoIoStream. The only way to close it is to destroy it by releasing all references.

Definition at line 31 of file Stream.h.


Public Member Functions

virtual FDO_API_COMMON FdoBoolean CanRead ()
 gets the reading capability.
virtual FDO_API_COMMON FdoBoolean CanWrite ()
 gets the writing capability.
virtual FDO_API_COMMON FdoInt64 GetIndex ()=0
 gets the current position for the stream.
virtual FDO_API_COMMON FdoInt64 GetLength ()=0
 gets the current length of the stream.
virtual FDO_API_COMMON FdoBoolean HasContext ()
 returns whether the stream has any positional context. Streams without context can only be read and written in a forward-only manner. These streams do not allow position and length changes.
virtual FDO_API_COMMON FdoSize Read (FdoByte *buffer, FdoSize count)=0
 reads the number of bytes indicated by count into the given buffer, or the number of bytes after the current stream position, whichever is less. The stream’s current position is moved ahead by the number of bytes read.
virtual FDO_API_COMMON void Reset ()=0
 sets the position to the start of the stream.
virtual FDO_API_COMMON void SetLength (FdoInt64 length)=0
 truncates the stream to the indicated length.
virtual FDO_API_COMMON void Skip (FdoInt64 offset)=0
 skips over part of the stream.
virtual FDO_API_COMMON void Write (FdoIoStream *stream, FdoSize count=0)=0
 reads the number of bytes from the given stream, and writes them to this stream.
virtual FDO_API_COMMON void Write (FdoByte *buffer, FdoSize count)=0
 writes the number of bytes indicated by count, from the given buffer, to the stream. The current position is moved ahead by the number of bytes written.

Member Function Documentation

virtual FDO_API_COMMON FdoBoolean FdoIoStream::CanRead  )  [inline, virtual]
 

gets the reading capability.

Returns:
Returns true if the stream can be read.

Reimplemented in FdoIoFileStream.

Definition at line 131 of file Stream.h.

References FDO_API_COMMON, and FdoBoolean.

virtual FDO_API_COMMON FdoBoolean FdoIoStream::CanWrite  )  [inline, virtual]
 

gets the writing capability.

Returns:
Returns true if the stream can be written to.

Reimplemented in FdoIoFileStream.

Definition at line 142 of file Stream.h.

References FDO_API_COMMON, and FdoBoolean.

virtual FDO_API_COMMON FdoInt64 FdoIoStream::GetIndex  )  [pure virtual]
 

gets the current position for the stream.

Returns:
Returns the position in bytes from the start. When 0, the the position is at the start of the stream. When GetIndex() == GetLength() the position is at the end of the stream.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON FdoInt64 FdoIoStream::GetLength  )  [pure virtual]
 

gets the current length of the stream.

Returns:
Returns the length in bytes. Returns -1 if the length is unknown or undefined.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON FdoBoolean FdoIoStream::HasContext  )  [inline, virtual]
 

returns whether the stream has any positional context. Streams without context can only be read and written in a forward-only manner. These streams do not allow position and length changes.

Returns:
Returns true if the stream has context. Returns false if it does not. When a stream does not have context, the SetLength(), Skip() and Reset() functions are not supported.

Reimplemented in FdoIoFileStream.

Definition at line 157 of file Stream.h.

References FDO_API_COMMON, and FdoBoolean.

virtual FDO_API_COMMON FdoSize FdoIoStream::Read FdoByte buffer,
FdoSize  count
[pure virtual]
 

reads the number of bytes indicated by count into the given buffer, or the number of bytes after the current stream position, whichever is less. The stream’s current position is moved ahead by the number of bytes read.

Parameters:
buffer Output read into this buffer
count Input read this number of bytes into the buffer. The caller is responsible for allocating a buffer that is large enough to hold the bytes.
Returns:
Returns the number of bytes that were read. 0 if already at the end of the stream.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON void FdoIoStream::Reset  )  [pure virtual]
 

sets the position to the start of the stream.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON void FdoIoStream::SetLength FdoInt64  length  )  [pure virtual]
 

truncates the stream to the indicated length.

Parameters:
length Input the new length (in bytes) for the stream. If this is longer than the current stream length then the stream's length is not changed.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON void FdoIoStream::Skip FdoInt64  offset  )  [pure virtual]
 

skips over part of the stream.

Parameters:
offset The number of bytes to skip. if positive then the current position is moved forward. If negative, the position is moved backward. The position will remain between the start and end of the stream. The position is set to the end of the stream if the given offset would put it past the end. Similarily, the position is set to the start if the offset would put it before the start.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON void FdoIoStream::Write FdoIoStream stream,
FdoSize  count = 0
[pure virtual]
 

reads the number of bytes from the given stream, and writes them to this stream.

Parameters:
stream Input write from this buffer
count Input the maximum number of bytes to read and write. When 0, all remaining bytes are read from the given stream.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.

virtual FDO_API_COMMON void FdoIoStream::Write FdoByte buffer,
FdoSize  count
[pure virtual]
 

writes the number of bytes indicated by count, from the given buffer, to the stream. The current position is moved ahead by the number of bytes written.

Parameters:
buffer Intput write from this buffer
count Input number of bytes to write
Note:
Write will overwrite some of the contents of the stream if the current position is not at the end of the stream.

Implemented in FdoIoBufferStream, FdoIoFileStream, and FdoIoMemoryStream.


The documentation for this class was generated from the following file:
Comments or suggestions? Send us feedback.