Ceylan::System::MemoryStream Class Reference

Makes a buffer in memory behaving like an InputOutputStream. More...

#include <CeylanMemoryStream.h>

Inheritance diagram for Ceylan::System::MemoryStream:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::System::MemoryStream:

Collaboration graph
[legend]

List of all members.

Classes

class  MemoryStreamException
 Mother class for all memory-related exceptions. More...

Public Types

typedef Size Index
 Index in the internal buffer.
enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 MemoryStream (Size bufferSize)
 Constructs a memory stream.
virtual ~MemoryStream () throw ()
 Destroys the file reference object, does not remove the file itself.
virtual void blank ()
 Blanks the buffer so that it is emptied.
virtual bool close ()
 Closes the stream for read/write actions.
virtual Size getSize () const
 Returns the buffer total size, in bytes.
virtual Size read (Ceylan::Byte *buffer, Size maxLength)
 Reads up to maxLength bytes from this stream to specified buffer.
virtual bool hasAvailableData () const
 Tells whether there is data available on input.
virtual Size write (const std::string &message)
 Writes message to this stream.
virtual Size write (const Ceylan::Byte *buffer, Size maxLength)
 Writes up to maxLength bytes from the specified buffer to this stream.
virtual Index getIndexOfNextFreeChunk () const
 Returns the index of the next free chunk in the buffer that is to be filled by read data.
virtual BytegetAddressOfNextFreeChunk () const
 Returns the index of the next free chunk in the buffer that is to be filled by read data .
virtual Size getSizeOfNextFreeChunk () const
 Returns the size of the biggest free chunk that can be found starting at the first free location in the buffer.
virtual Index getBlockIndex () const
 Returns the current index of filled block in buffer.
virtual Size getBlockLength () const
 Returns the current length of filled block in buffer.
virtual Ceylan::Byte getElementAt (Index targetIndex) const
 Returns the element at specified index in buffer.
virtual void increaseFilledBlockOf (Size bytesAdded)
 Declares that specified size should be added to the current size of the buffer.
virtual void moveFilledBlockToBufferStart ()
 Translates the filled block in buffer so that the beginning of block is at the beginning of buffer.
virtual StreamID getStreamID () const
 Returns this file's ID.
virtual StreamID getInputStreamID () const
 Returns this file descriptor for this file, or -1 if the file descriptor feature is not available.
virtual StreamID getOutputStreamID () const
 Returns this file descriptor for this file, or -1 if the file descriptor feature is not available.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.
bool isSelected () const
 Tells if the stream has data to read.
bool isFaulty () const
virtual void clearInput ()
 Clears the input stream.
virtual Ceylan::Sint8 readSint8 ()
 Returns a Ceylan::Sint8 read from this input stream.
virtual Ceylan::Uint8 readUint8 ()
 Returns a Ceylan::Uint8 read from this input stream.
virtual Ceylan::Sint16 readSint16 ()
 Returns a Ceylan::Sint16 read from this input stream.
virtual Ceylan::Uint16 readUint16 ()
 Returns a Ceylan::Uint16 read from this input stream.
virtual Ceylan::Sint32 readSint32 ()
 Returns a Ceylan::Sint32 read from this input stream.
virtual Ceylan::Uint32 readUint32 ()
 Returns a Ceylan::Uint32 read from this input stream.
virtual Ceylan::Float32 readFloat32 ()
 Returns a Ceylan::Float32 read from this input stream.
virtual Ceylan::Float64 readFloat64 ()
 Returns a Ceylan::Float64 read from this input stream.
virtual void readString (std::string &result)
 Reads a string from this input stream, and stores it in the specified string.
virtual void skipWhitespaces (Ceylan::Uint8 &firstNonSpace)
 Reads from this input stream as long as there are whitespaces to be read.
bool isBlocking () const
 Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).
virtual void writeSint8 (Ceylan::Sint8 toWrite)
 Writes a Ceylan::Sint8 to this output stream.
virtual void writeUint8 (Ceylan::Uint8 toWrite)
 Writes a Ceylan::Uint8 to this output stream.
virtual void writeSint16 (Ceylan::Sint16 toWrite)
 Writes a Ceylan::Sint16 to this output stream.
virtual void writeUint16 (Ceylan::Uint16 toWrite)
 Writes a Ceylan::Uint16 to this output stream.
virtual void writeSint32 (Ceylan::Sint32 toWrite)
 Writes a Ceylan::Sint32 to this output stream.
virtual void writeUint32 (Ceylan::Uint32 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeFloat32 (Ceylan::Float32 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeFloat64 (Ceylan::Float64 toWrite)
 Writes a Ceylan::Uint32 to this output stream.
virtual void writeString (const std::string &toWrite)
 Writes a string to this output stream.

Static Public Member Functions

static Ceylan::Uint16 Select (std::list< InputStream * > &is)
 Blocks the calling thread until bytes become available on one or more streams in is.
static Ceylan::Uint16 Test (std::list< InputStream * > &is)
 Checks whether bytes become available on one or more streams in is.
static bool Close (FileDescriptor &fd)
 Closes and zeroes the specified file descriptor.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

virtual void setSelected (bool newStatus)
 Used to set the selection status of this stream.
void setFaulty (bool newFaultyState=true)
 Sets the faulty state of this stream.
virtual void setStreamID (StreamID newInputStreamID)
 Sets this input stream's unique ID.
virtual void setBlocking (bool newStatus)
 Sets the blocking mode of this stream.

Protected Attributes

Size _size
 The total size of the internal buffer.
Size _index
 The current index of the beginning of the filled block in the buffer.
Size _len
 The current length of the filled block in the buffer.
Ceylan::Byte_buffer
 The internal buffer.
bool _isBlocking
 Stores whether the stream is in blocking mode.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 MemoryStream (const MemoryStream &source)
 Copy constructor made private to ensure that it will be never called.
MemoryStreamoperator= (const MemoryStream &source)
 Assignment operator made private to ensure that it will be never called.


Detailed Description

Makes a buffer in memory behaving like an InputOutputStream.

Useful to test some modules like Marshaller ones.

Definition at line 58 of file CeylanMemoryStream.h.


Member Typedef Documentation

Index in the internal buffer.

Definition at line 67 of file CeylanMemoryStream.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

MemoryStream::MemoryStream ( Size  bufferSize  )  [explicit]

Constructs a memory stream.

Parameters:
bufferSize the size in bytes of the buffer.

Definition at line 92 of file CeylanMemoryStream.cc.

References _buffer.

MemoryStream::~MemoryStream (  )  throw () [virtual]

Destroys the file reference object, does not remove the file itself.

To remove the file from disk, use remove().

See also:
remove

Definition at line 106 of file CeylanMemoryStream.cc.

References _buffer.

Ceylan::System::MemoryStream::MemoryStream ( const MemoryStream source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void MemoryStream::blank (  )  [virtual]

Blanks the buffer so that it is emptied.

Definition at line 115 of file CeylanMemoryStream.cc.

References _index, and _len.

void InputStream::clearInput (  )  [virtual, inherited]

Clears the input stream.

Exceptions:
InputStream::ReadFailedException if the operation failed.

Reimplemented in Ceylan::System::Pipe.

Definition at line 179 of file CeylanInputStream.cc.

References dataUtils::b, Ceylan::System::InputStream::hasAvailableData(), and Ceylan::System::InputStream::read().

bool Stream::Close ( FileDescriptor fd  )  [static, inherited]

Closes and zeroes the specified file descriptor.

It is passed by address so that this function can set it to zero on successful close.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed.

Definition at line 114 of file CeylanStream.cc.

References Ceylan::System::Stream::close(), generalUtils::false, Ceylan::toString(), and generalUtils::true.

Referenced by Ceylan::System::StandardFile::close(), Ceylan::Network::Socket::close(), Ceylan::System::Pipe::close(), and Ceylan::System::LibfatFile::close().

bool MemoryStream::close (  )  [virtual]

Closes the stream for read/write actions.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed, including if the file was not already opened.

Implements Ceylan::System::Stream.

Definition at line 125 of file CeylanMemoryStream.cc.

References generalUtils::false.

Ceylan::Byte * MemoryStream::getAddressOfNextFreeChunk (  )  const [virtual]

Returns the index of the next free chunk in the buffer that is to be filled by read data .

It corresponds to the current end of filled buffer.

See also:
getSize

Definition at line 335 of file CeylanMemoryStream.cc.

References _buffer, and getIndexOfNextFreeChunk().

Referenced by Ceylan::Middleware::Marshaller::retrieveData().

MemoryStream::Index MemoryStream::getBlockIndex (  )  const [virtual]

Returns the current index of filled block in buffer.

Definition at line 356 of file CeylanMemoryStream.cc.

References _index.

Size MemoryStream::getBlockLength (  )  const [virtual]

Returns the current length of filled block in buffer.

Definition at line 365 of file CeylanMemoryStream.cc.

References _len.

Referenced by Ceylan::Middleware::Marshaller::retrieveData().

Ceylan::Byte MemoryStream::getElementAt ( Index  targetIndex  )  const [virtual]

Returns the element at specified index in buffer.

Parameters:
targetIndex the index of the requested element. It will wrapped around (modulo) if necessary, so that it is in [0;getSize()[

Definition at line 374 of file CeylanMemoryStream.cc.

References _buffer, and _size.

Referenced by toString().

MemoryStream::Index MemoryStream::getIndexOfNextFreeChunk (  )  const [virtual]

Returns the index of the next free chunk in the buffer that is to be filled by read data.

It corresponds to the current end of filled buffer.

See also:
getSize

Definition at line 326 of file CeylanMemoryStream.cc.

References _index, _len, and _size.

Referenced by getAddressOfNextFreeChunk(), and getSizeOfNextFreeChunk().

StreamID MemoryStream::getInputStreamID (  )  const [virtual]

Returns this file descriptor for this file, or -1 if the file descriptor feature is not available.

Implements Ceylan::System::InputStream.

Definition at line 480 of file CeylanMemoryStream.cc.

References getStreamID().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

StreamID MemoryStream::getOutputStreamID (  )  const [virtual]

Returns this file descriptor for this file, or -1 if the file descriptor feature is not available.

Implements Ceylan::System::OutputStream.

Definition at line 489 of file CeylanMemoryStream.cc.

References getStreamID().

Size MemoryStream::getSize (  )  const [virtual]

Returns the buffer total size, in bytes.

See also:
getSize

Definition at line 134 of file CeylanMemoryStream.cc.

References _size.

Referenced by Ceylan::Middleware::Marshaller::retrieveData().

Size MemoryStream::getSizeOfNextFreeChunk (  )  const [virtual]

Returns the size of the biggest free chunk that can be found starting at the first free location in the buffer.

It corresponds to the size, in bytes, between the current end of filled buffer and the end of the overall buffer.

See also:
getSize

Definition at line 344 of file CeylanMemoryStream.cc.

References _index, _len, _size, and getIndexOfNextFreeChunk().

Referenced by increaseFilledBlockOf(), and Ceylan::Middleware::Marshaller::retrieveData().

StreamID MemoryStream::getStreamID (  )  const [virtual]

Returns this file's ID.

Returns:
the StreamID, generated from the value of this.

Definition at line 447 of file CeylanMemoryStream.cc.

Referenced by getInputStreamID(), getOutputStreamID(), and toString().

bool MemoryStream::hasAvailableData (  )  const [virtual]

Tells whether there is data available on input.

Implements Ceylan::System::InputStream.

Definition at line 229 of file CeylanMemoryStream.cc.

References _len.

void MemoryStream::increaseFilledBlockOf ( Size  bytesAdded  )  [virtual]

Declares that specified size should be added to the current size of the buffer.

It is used whenever data is directly written to the internal buffer for better performance.

Parameters:
bytesAdded the number of bytes added to the filled block in buffer. It must of course not go past the end of the internal buffer.
Exceptions:
MemoryStreamException if the specified size is too big for the remaining space.

Definition at line 383 of file CeylanMemoryStream.cc.

References _len, and getSizeOfNextFreeChunk().

Referenced by Ceylan::Middleware::Marshaller::retrieveData().

bool Stream::isBlocking (  )  const [inherited]

Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).

Definition at line 93 of file CeylanStream.cc.

References Ceylan::System::Stream::_isBlocking.

Referenced by Ceylan::Network::StreamSocket::createSocket(), and Ceylan::Network::Socket::toString().

bool InputStream::isFaulty (  )  const [inherited]

bool InputStream::isSelected (  )  const [inherited]

Tells if the stream has data to read.

Definition at line 122 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::_isSelected.

Referenced by Ceylan::System::InputStream::toString().

void MemoryStream::moveFilledBlockToBufferStart (  )  [virtual]

Translates the filled block in buffer so that the beginning of block is at the beginning of buffer.

This way, the free space of the buffer goes from the end of filled block to the end of buffer, and if more data is read, it will still make one block in buffer.

Definition at line 395 of file CeylanMemoryStream.cc.

References _buffer, _index, _len, and _size.

Referenced by Ceylan::Middleware::Marshaller::retrieveData().

MemoryStream& Ceylan::System::MemoryStream::operator= ( const MemoryStream source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

Size MemoryStream::read ( Ceylan::Byte buffer,
Size  maxLength 
) [virtual]

Reads up to maxLength bytes from this stream to specified buffer.

Parameters:
buffer the buffer where to store read bytes. Its size must be at least maxLength bytes.
maxLength the maximum number of bytes that should be read.
Returns:
The number of bytes actually read, which should be maxLength or lower.
Exceptions:
ReadFailed if a read error occurred.

Reimplemented from Ceylan::System::InputStream.

Definition at line 143 of file CeylanMemoryStream.cc.

References _buffer, _index, _len, _size, DISPLAY_DEBUG_MEMORY_STREAM, toString(), and Ceylan::toString().

Ceylan::Float32 InputStream::readFloat32 (  )  [virtual, inherited]

Returns a Ceylan::Float32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 356 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeFloat32().

Ceylan::Float64 InputStream::readFloat64 (  )  [virtual, inherited]

Returns a Ceylan::Float64 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 392 of file CeylanInputStream.cc.

References Ceylan::byteswap(), ceylan_bswap_64, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeFloat64().

Ceylan::Sint16 InputStream::readSint16 (  )  [virtual, inherited]

Returns a Ceylan::Sint16 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 239 of file CeylanInputStream.cc.

References ceylan_bswap_16, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint16().

Ceylan::Sint32 InputStream::readSint32 (  )  [virtual, inherited]

Returns a Ceylan::Sint32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 298 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint32().

Ceylan::Sint8 InputStream::readSint8 (  )  [virtual, inherited]

Returns a Ceylan::Sint8 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 203 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeSint8().

void InputStream::readString ( std::string &  result  )  [virtual, inherited]

Reads a string from this input stream, and stores it in the specified string.

Note:
Read strings can have no more than 65535 characters.
Parameters:
result the string to fill from this input stream.
Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 437 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::read(), Ceylan::System::InputStream::readUint16(), and Ceylan::toString().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeString().

Ceylan::Uint16 InputStream::readUint16 (  )  [virtual, inherited]

Returns a Ceylan::Uint16 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 268 of file CeylanInputStream.cc.

References ceylan_bswap_16, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeUint16(), and Ceylan::System::InputStream::readString().

Ceylan::Uint32 InputStream::readUint32 (  )  [virtual, inherited]

Returns a Ceylan::Uint32 read from this input stream.

Exceptions:
ReadFailedException in case a system error occured, or EOFException is a protocol error occured, with fewer bytes available than expected.

Definition at line 327 of file CeylanInputStream.cc.

References ceylan_bswap_32, and Ceylan::System::InputStream::read().

Referenced by Ceylan::Middleware::LightWeightMarshaller::decodeUint32().

Ceylan::Uint8 InputStream::readUint8 (  )  [virtual, inherited]

Ceylan::Uint16 InputStream::Select ( std::list< InputStream * > &  is  )  [static, inherited]

Blocks the calling thread until bytes become available on one or more streams in is.

To see which are selected, use the isSelected method.

Returns:
the number of selected streams.
See also:
the non-blocking version, Test.
Exceptions:
SelectFailedException if the operation failed, for example if the file descriptor feature is not available on this platform.

Definition at line 534 of file CeylanInputStream.cc.

References Ceylan::System::explainError(), Ceylan::Network::explainSocketError(), Ceylan::System::getError(), Ceylan::Network::getSocketError(), Ceylan::System::Thread::Sleep(), and Ceylan::toString().

Referenced by Ceylan::Network::MultiplexedServerStreamSocket::run().

void Stream::setBlocking ( bool  newStatus  )  [protected, virtual, inherited]

Sets the blocking mode of this stream.

Parameters:
newStatus if true, sets the stream in blocking mode, if false set to non-blocking mode. If the stream is already in the target state, nothing is done.
Exceptions:
NonBlockingNotSupportedException if the operation failed or is not supported.
Note:
This default implementation always raises its exception, streams that supports non-blocking access have to override it.

Reimplemented in Ceylan::Network::Socket, and Ceylan::Network::StreamSocket.

Definition at line 175 of file CeylanStream.cc.

void InputStream::setFaulty ( bool  newFaultyState = true  )  [protected, inherited]

Sets the faulty state of this stream.

Parameters:
newFaultyState the new faulty state.

Definition at line 1004 of file CeylanInputStream.cc.

References Ceylan::System::InputStream::_isFaulty.

Referenced by Ceylan::Network::MultiplexedServerStreamSocket::run().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

void InputStream::setSelected ( bool  newStatus  )  [protected, virtual, inherited]

void InputStream::setStreamID ( StreamID  newInputStreamID  )  [protected, virtual, inherited]

Sets this input stream's unique ID.

Exceptions:
InputStreamException in all cases as long as not specifically overriden.

Definition at line 1013 of file CeylanInputStream.cc.

void InputStream::skipWhitespaces ( Ceylan::Uint8 firstNonSpace  )  [virtual, inherited]

Reads from this input stream as long as there are whitespaces to be read.

Parameters:
firstNonSpace the variable which will be set by this method to the value of the first non-whitespace character that is read.

Definition at line 516 of file CeylanInputStream.cc.

References Ceylan::isWhitespace(), and Ceylan::System::InputStream::readUint8().

Referenced by Ceylan::XML::XMLParser::handleNextElement().

Ceylan::Uint16 InputStream::Test ( std::list< InputStream * > &  is  )  [static, inherited]

Checks whether bytes become available on one or more streams in is.

To see which are selected, use the isSelected method.

This method returns always immediatly.

Returns:
the number of selected streams.
See also:
the blocking version, Select.
Exceptions:
SelectFailedException if the operation failed, for example if the file descriptor feature is not available on this platform.

Definition at line 863 of file CeylanInputStream.cc.

References Ceylan::System::explainError(), and Ceylan::System::getError().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const std::string MemoryStream::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this object.

If the highest level of detail is requested, the full buffer will be dumped.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::System::InputOutputStream.

Definition at line 498 of file CeylanMemoryStream.cc.

References _index, _len, _size, getElementAt(), getStreamID(), Ceylan::high, and Ceylan::toNumericalString().

Referenced by read(), Ceylan::Middleware::Marshaller::toString(), and write().

Size MemoryStream::write ( const Ceylan::Byte buffer,
Size  maxLength 
) [virtual]

Writes up to maxLength bytes from the specified buffer to this stream.

Parameters:
buffer the buffer where to find bytes that must be written to this file. Its size must be at least maxLength bytes.
Returns:
The number of bytes actually written, which should be equal to maxLength.
Exceptions:
WriteFailedException if a write error occurred.

Reimplemented from Ceylan::System::OutputStream.

Definition at line 247 of file CeylanMemoryStream.cc.

References _buffer, _index, _len, _size, DISPLAY_DEBUG_MEMORY_STREAM, toString(), and Ceylan::toString().

Size MemoryStream::write ( const std::string &  message  )  [virtual]

Writes message to this stream.

Parameters:
message the message to write to this stream.
Returns:
The number of bytes actually written, which should be equal to the size of the string or lower.
Exceptions:
WriteFailedException if a write error occurred.

Reimplemented from Ceylan::System::OutputStream.

Definition at line 238 of file CeylanMemoryStream.cc.

void OutputStream::writeFloat32 ( Ceylan::Float32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 219 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat32().

void OutputStream::writeFloat64 ( Ceylan::Float64  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 247 of file CeylanOutputStream.cc.

References Ceylan::byteswap(), ceylan_bswap_64, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat64().

void OutputStream::writeSint16 ( Ceylan::Sint16  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint16 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 119 of file CeylanOutputStream.cc.

References ceylan_bswap_16, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint16().

void OutputStream::writeSint32 ( Ceylan::Sint32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 169 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint32().

void OutputStream::writeSint8 ( Ceylan::Sint8  toWrite  )  [virtual, inherited]

Writes a Ceylan::Sint8 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 89 of file CeylanOutputStream.cc.

References Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint8().

void OutputStream::writeString ( const std::string &  toWrite  )  [virtual, inherited]

Writes a string to this output stream.

Note:
Written strings cannot have more than 65535 characters.
Parameters:
toWrite the string to write to this output stream.
Exceptions:
WriteFailedException in case a system error occured.

Definition at line 286 of file CeylanOutputStream.cc.

References Ceylan::Log::LogPlug::debug(), Ceylan::toString(), Ceylan::Uint16Max, Ceylan::System::OutputStream::write(), and Ceylan::System::OutputStream::writeUint16().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeString().

void OutputStream::writeUint16 ( Ceylan::Uint16  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint16 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 144 of file CeylanOutputStream.cc.

References ceylan_bswap_16, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint16(), and Ceylan::System::OutputStream::writeString().

void OutputStream::writeUint32 ( Ceylan::Uint32  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint32 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 194 of file CeylanOutputStream.cc.

References ceylan_bswap_32, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint32().

void OutputStream::writeUint8 ( Ceylan::Uint8  toWrite  )  [virtual, inherited]

Writes a Ceylan::Uint8 to this output stream.

Exceptions:
WriteFailedException in case a system error occured.

Definition at line 104 of file CeylanOutputStream.cc.

References Ceylan::System::OutputStream::write().

Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint8(), and Ceylan::XML::XMLSavingVisitor::visit().


Member Data Documentation

The current index of the beginning of the filled block in the buffer.

Definition at line 368 of file CeylanMemoryStream.h.

Referenced by blank(), getBlockIndex(), getIndexOfNextFreeChunk(), getSizeOfNextFreeChunk(), moveFilledBlockToBufferStart(), read(), toString(), and write().

bool Ceylan::System::Stream::_isBlocking [protected, inherited]

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

The total size of the internal buffer.

Definition at line 360 of file CeylanMemoryStream.h.

Referenced by getElementAt(), getIndexOfNextFreeChunk(), getSize(), getSizeOfNextFreeChunk(), moveFilledBlockToBufferStart(), read(), toString(), and write().


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

Generated on Thu Jun 4 20:41:01 2009 for Ceylan by  doxygen 1.5.8