Stream

Engine/source/core/stream/stream.h

Base stream class for streaming data across a specific media.

More...

Public Types

enum
Capability {
  StreamWrite = BIT(0)
  StreamRead = BIT(1)
  StreamPosition = BIT(2)
}
enum
StreamStatus {
  Ok = 0
  IOError 
  EOS 
  IllegalCall 
  Closed 
  UnknownError 
}

Status constants for the stream.

Private Attributes

Protected Functions

bool
_read(const U32 in_numBytes, void * out_pBuffer)
_read(String * str)
bool
_write(const U32 in_numBytes, const void * in_pBuffer)

Public Functions

Create an exact replica of this stream.

bool
copyFrom(Stream * other)

Copy the contents of another stream into this one.

Gets the position in the stream.

Gets the status of the stream.

Gets the size of the stream.

bool

Checks to see if this stream has the capability of a given function.

bool
Put(char character)
bool
read(bool * out_pRead)
bool

Read an integral color from the stream.

bool
read(const U32 in_numBytes, void * out_pBuffer)
bool

Read a floating point color from the stream.

bool

Read a network address from the stream.

bool

Read a network socket from the stream.

bool

Read some raw data from the stream.

read(String * str)
bool

Read some raw data from the stream.

readLine(U8 * buffer, U32 bufferSize)

Reads a line from the stream.

readLongString(U32 maxStringLen, char * stringBuf)

Reads a string that could potentially be more than 255 characters long.

readString(char stringBuf)

Reads a string of maximum 255 characters long.

const char *
readSTString(bool casesens)

Reads a string and inserts it into the StringTable.

bool
setPosition(const U32 in_newPosition)

Sets the position of the stream. Returns if the new position is valid or not.

bool
write(const bool & in_rWrite)
bool

Write an integral color to the stream.

bool

Write a floating point color to the stream.

bool

Write a network address to the stream.

bool

Write a network socket to the stream.

bool

Write some raw data onto the stream.

bool

Write some raw data onto the stream.

bool
write(const U32 in_numBytes, const void * in_pBuffer)
bool
writeFormattedBuffer(const char * format, ... )

Writes a formatted buffer to the stream.

writeLine(const U8 * buffer)

writes a line to the stream

writeLongString(U32 maxStringLen, const char * string)

Writes a string to the stream.

writeString(const char * stringBuf, S32 maxLen)

Writes a string to the stream.

bool
writeStringBuffer(const char * buffer)

Writes a NULL terminated string buffer.

writeTabs(U32 count)

Write a number of tabs to this stream.

writeText(const char * text)

Write raw text to the stream.

Public Static Functions

const char *

Gets a printable string form of the status.

Detailed Description

Base stream class for streaming data across a specific media.

Public Types

Capability

Enumerator

StreamWrite = BIT(0)

Can this stream write?

StreamRead = BIT(1)

Can this stream read?

StreamPosition = BIT(2)

Can this stream position?

StreamStatus

Enumerator

Ok = 0

Ok!

IOError

Read or Write error.

EOS

End of Stream reached (mostly for reads)

IllegalCall

An unsupported operation used. Always w/ accompanied by AssertWarn.

Closed

Tried to operate on a closed stream (or detached filter)

UnknownError

Catchall.

Status constants for the stream.

Private Attributes

StreamStatus m_streamStatus 

Protected Functions

_read(const U32 in_numBytes, void * out_pBuffer)

Reimplemented by: FileStream, FilterStream, ResizeFilterStream, MemStream, ZipCryptRStream, ZipSubRStream, ZipSubWStream, Zip::ZipStatFilter, BitStream

_read(String * str)

_write(const String & str)

_write(const U32 in_numBytes, const void * in_pBuffer)

Reimplemented by: FileStream, FilterStream, MemStream, ZipSubWStream, Zip::ZipStatFilter, BitStream

setStatus(const StreamStatus in_newStatus)

Public Functions

Stream()

~Stream()

clone()

Create an exact replica of this stream.

Return NULL if the cloning fails.

Reimplemented by: FileStream

copyFrom(Stream * other)

Copy the contents of another stream into this one.

getPosition()

Gets the position in the stream.

Reimplemented by: FilterStream, ResizeFilterStream, BitStream, FileStream, MemStream, ZipCryptRStream, ZipSubRStream, ZipSubWStream

getStatus()

Gets the status of the stream.

getStreamSize()

Gets the size of the stream.

Reimplemented by: FilterStream, ResizeFilterStream, BitStream, FileStream, MemStream, ZipSubRStream, ZipSubWStream

hasCapability(const Capability caps)

Checks to see if this stream has the capability of a given function.

Reimplemented by: MemStream, FileStream, FilterStream, BitStream, ZipSubRStream, ZipSubWStream

Put(char character)

read(bool * out_pRead)

read(ColorI * )

Read an integral color from the stream.

read(const U32 in_numBytes, void * out_pBuffer)

read(LinearColorF * )

Read a floating point color from the stream.

read(NetAddress * )

Read a network address from the stream.

read(NetSocket * )

Read a network socket from the stream.

read(RawData * )

Read some raw data from the stream.

read(String * str)

read(Torque::ByteBuffer * )

Read some raw data from the stream.

readLine(U8 * buffer, U32 bufferSize)

Reads a line from the stream.

Parameters:

buffer

buffer to be read into

bufferSize

max size of the buffer. Will not read more than the "bufferSize"

readLongString(U32 maxStringLen, char * stringBuf)

Reads a string that could potentially be more than 255 characters long.

Parameters:

maxStringLen

Maximum length to read. If the string is longer than maxStringLen, only maxStringLen bytes will be read.

stringBuf

buffer where data is read into

readString(char stringBuf)

Reads a string of maximum 255 characters long.

Reimplemented by: BitStream

readSTString(bool casesens)

Reads a string and inserts it into the StringTable.

setPosition(const U32 in_newPosition)

Sets the position of the stream. Returns if the new position is valid or not.

Reimplemented by: FileStream, Zip::ZipTempStream, FilterStream, ResizeFilterStream, BitStream, MemStream, ZipCryptRStream, ZipSubRStream, ZipSubWStream

write(const bool & in_rWrite)

write(const ColorI & )

Write an integral color to the stream.

write(const LinearColorF & )

Write a floating point color to the stream.

write(const NetAddress & )

Write a network address to the stream.

write(const NetSocket & )

Write a network socket to the stream.

write(const RawData & )

Write some raw data onto the stream.

write(const String & str)

write(const Torque::ByteBuffer & )

Write some raw data onto the stream.

write(const U32 in_numBytes, const void * in_pBuffer)

writeFormattedBuffer(const char * format, ... )

Writes a formatted buffer to the stream.

NOTE: A maximum string length of 4K is allowed.

writeLine(const U8 * buffer)

writes a line to the stream

writeLongString(U32 maxStringLen, const char * string)

Writes a string to the stream.

This function is slightly unstable. Only use this if you have a valid string that is not empty. writeString is safer.

writeString(const char * stringBuf, S32 maxLen)

Writes a string to the stream.

Reimplemented by: BitStream

writeStringBuffer(const char * buffer)

Writes a NULL terminated string buffer.

writeTabs(U32 count)

Write a number of tabs to this stream.

writeText(const char * text)

Write raw text to the stream.

Public Static Functions

getStatusString(const StreamStatus in_status)

Gets a printable string form of the status.