Rocket::Core::Stream Class Reference

#include <Stream.h>

Inheritance diagram for Rocket::Core::Stream:
Collaboration diagram for Rocket::Core::Stream:

Public Types

enum  StreamMode {
  MODE_WRITE = 1 << 0, MODE_APPEND = 1 << 1, MODE_READ = 1 << 2, MODE_ASYNC = 1 << 3,
  MODE_MASK = MODE_WRITE | MODE_APPEND | MODE_READ
}

Public Member Functions

virtual void Close ()
 Closes the stream.
int GetStreamMode () const
 Returns the mode the stream was opened in.
const URLGetSourceURL () const
 Obtain the source url of this stream (if available).
virtual bool IsEOS () const
 Are we at the end of the stream.
virtual size_t Length () const =0
 Returns the size of this stream (in bytes).
virtual size_t Tell () const =0
 Returns the position of the stream pointer (in bytes).
virtual bool Seek (long offset, int origin) const =0
 Sets the stream position (in bytes).
virtual size_t Read (void *buffer, size_t bytes) const =0
 Read from the stream.
virtual size_t Read (Stream *stream, size_t bytes) const
 Read from the stream into another stream.
virtual size_t Read (String &buffer, size_t bytes) const
 Read from the stream and append to the string buffer.
virtual size_t Peek (void *buffer, size_t bytes) const
 Read from the stream, without increasing the stream offset.
virtual size_t Write (const void *buffer, size_t bytes)=0
 Write to the stream at the current position.
virtual size_t Write (const Stream *stream, size_t bytes)
 Write to this stream from another stream.
virtual size_t Write (const char *string)
 Write a character array to the stream.
virtual size_t Write (const String &string)
 Write a string to the stream.
virtual size_t Truncate (size_t bytes)=0
 Truncate the stream to the specified length.
virtual size_t PushFront (const void *buffer, size_t bytes)
 Push onto the front of the stream.
virtual size_t PushBack (const void *buffer, size_t bytes)
 Push onto the back of the stream.
virtual size_t PopFront (size_t bytes)
 Pop from the front of the stream.
virtual size_t PopBack (size_t bytes)
 Pop from the back of the stream.
virtual bool IsReadReady ()=0
virtual bool IsWriteReady ()=0

Protected Member Functions

void SetStreamDetails (const URL &url, int stream_mode)
 Sets the mode on the stream; should be called by a stream when it is opened.
virtual void OnReferenceDeactivate ()
 Deletes the stream.

Detailed Description

Abstract class for a media-independent byte stream.
Author:
Lloyd Weehuizen

Member Function Documentation

virtual bool Rocket::Core::Stream::IsReadReady (  )  [pure virtual]

Returns true if the stream is ready for reading, false otherwise. This is usually only implemented on streams supporting asynchronous operations.

Implemented in Rocket::Core::StreamMemory, and Rocket::Core::StreamFile.

virtual bool Rocket::Core::Stream::IsWriteReady (  )  [pure virtual]

Returns true if the stream is ready for writing, false otherwise. This is usually only implemented on streams supporting asynchronous operations.

Implemented in Rocket::Core::StreamMemory, and Rocket::Core::StreamFile.


The documentation for this class was generated from the following files:
  • Include/Rocket/Core/Stream.h
  • Source/Core/Stream.cpp