Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::io::DataOutputStream Class Referenceabstract

A class/interface which represents an abstract write-only stream of data. More...

#include <omDataOutputStream.h>

Inheritance diagram for om::io::DataOutputStream:
om::compression::CompressedOutputStream om::io::BinaryEncoder om::io::FileWriter om::resources::ResourceEncoder

Public Member Functions

virtual ~DataOutputStream ()
 Destroy an output stream and free all of its resources (close it). More...
 
Size writeData (const data::Data &data)
 Write as much of the specified data array to the stream and return the number of bytes written. More...
 
Size writeData (const data::DataBuffer &dataBuffer)
 Write as much of the specified data array to the stream and return the number of bytes written. More...
 
virtual Size writeData (const UByte *data, Size number)=0
 Write the specified number of bytes of data from the buffer to the stream. More...
 
virtual void flush ()=0
 Flush the output stream, sending all internally buffered output to it's destination. More...
 
virtual Bool canSeek () const =0
 Return whether or not this type of stream allows seeking. More...
 
virtual Bool canSeek (Int64 relativeOffset) const =0
 Return whether or not this stream can seek by the specified amount in bytes. More...
 
virtual Int64 seek (Int64 relativeOffset)=0
 Move the current position in the stream by the specified relative signed offset in bytes. More...
 
virtual LargeIndex getPosition () const =0
 Return the absolute position in the stream in bytes. More...
 

Detailed Description

A class/interface which represents an abstract write-only stream of data.

Constructor & Destructor Documentation

virtual om::io::DataOutputStream::~DataOutputStream ( )
inlinevirtual

Destroy an output stream and free all of its resources (close it).

Member Function Documentation

Size om::io::DataOutputStream::writeData ( const data::Data data)
inline

Write as much of the specified data array to the stream and return the number of bytes written.

Size om::io::DataOutputStream::writeData ( const data::DataBuffer dataBuffer)
inline

Write as much of the specified data array to the stream and return the number of bytes written.

virtual Size om::io::DataOutputStream::writeData ( const UByte data,
Size  number 
)
pure virtual

Write the specified number of bytes of data from the buffer to the stream.

The method returns the number of bytes that were actually written.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.

virtual void om::io::DataOutputStream::flush ( )
pure virtual

Flush the output stream, sending all internally buffered output to it's destination.

This method causes all currently pending output data to be sent to it's final destination. This method ensures that this is done and that all internal data buffers are emptied if they have any contents.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.

virtual Bool om::io::DataOutputStream::canSeek ( ) const
pure virtual

Return whether or not this type of stream allows seeking.

Some types of IO (like files) allow seeking, but others, especially those over networks don't allow streaming. This method allows the user to detect that situation.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.

virtual Bool om::io::DataOutputStream::canSeek ( Int64  relativeOffset) const
pure virtual

Return whether or not this stream can seek by the specified amount in bytes.

Since some streams may not support rewinding, this method can be used to determine if a given seek operation can succeed. The method can also be used to determine if the end of a stream has been reached, a seek past the end of a file will fail.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.

virtual Int64 om::io::DataOutputStream::seek ( Int64  relativeOffset)
pure virtual

Move the current position in the stream by the specified relative signed offset in bytes.

The method attempts to seek in the stream by the specified amount and returns the signed amount that the position in the stream was changed by in bytes. A negative offset indicates that the position should be moved in reverse and a positive offset indicates that the position should be moved forwards.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.

virtual LargeIndex om::io::DataOutputStream::getPosition ( ) const
pure virtual

Return the absolute position in the stream in bytes.

Implemented in om::io::BinaryEncoder, om::resources::ResourceEncoder, om::io::FileWriter, and om::compression::CompressedOutputStream.


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