activemq-cpp-3.6.0
decaf::io::Reader Class Reference

#include <src/main/decaf/io/Reader.h>

Inheritance diagram for decaf::io::Reader:

Public Member Functions

virtual ~Reader ()
virtual void mark (int readAheadLimit)
 Marks the present position in the stream.
virtual bool markSupported () const
 Tells whether this stream supports the mark() operation.
virtual bool ready () const
 Tells whether this stream is ready to be read.
virtual void reset ()
 Resets the stream.
virtual long long skip (long long count)
 Skips characters.
virtual int read (std::vector< char > &buffer)
 Reads characters into an array.
virtual int read (char *buffer, int size)
 Reads characters into an array, the method will attempt to read as much data as the size of the array.
virtual int read (char *buffer, int size, int offset, int length)
 Reads characters into a portion of an array.
virtual int read ()
 Reads a single character.
virtual int read (decaf::nio::CharBuffer *charBuffer)
 Attempts to read characters into the specified character buffer.
- Public Member Functions inherited from decaf::io::Closeable
virtual ~Closeable ()
virtual void close ()=0
 Closes this object and deallocates the appropriate resources.
- Public Member Functions inherited from decaf::lang::Readable
virtual ~Readable ()

Protected Member Functions

 Reader ()
virtual int doReadArrayBounded (char *buffer, int size, int offset, int length)=0
 Override this method to customize the functionality of the method read( unsigned char* buffer, int size, int offset, int length ).
virtual int doReadVector (std::vector< char > &buffer)
 Override this method to customize the functionality of the method read( std::vector<char>& buffer ).
virtual int doReadArray (char *buffer, int length)
 Override this method to customize the functionality of the method read( char* buffer, std::size_t length ).
virtual int doReadChar ()
 Override this method to customize the functionality of the method read().
virtual int doReadCharBuffer (decaf::nio::CharBuffer *charBuffer)
 Override this method to customize the functionality of the method read( CharBuffer* charBuffer ).

Constructor & Destructor Documentation

decaf::io::Reader::Reader ( )
protected
virtual decaf::io::Reader::~Reader ( )
virtual

Member Function Documentation

virtual int decaf::io::Reader::doReadArray ( char *  buffer,
int  length 
)
protectedvirtual

Override this method to customize the functionality of the method read( char* buffer, std::size_t length ).

virtual int decaf::io::Reader::doReadArrayBounded ( char *  buffer,
int  size,
int  offset,
int  length 
)
protectedpure virtual

Override this method to customize the functionality of the method read( unsigned char* buffer, int size, int offset, int length ).

All subclasses must override this method to provide the basic Reader functionality.

Implemented in decaf::io::InputStreamReader.

virtual int decaf::io::Reader::doReadChar ( )
protectedvirtual

Override this method to customize the functionality of the method read().

virtual int decaf::io::Reader::doReadCharBuffer ( decaf::nio::CharBuffer charBuffer)
protectedvirtual

Override this method to customize the functionality of the method read( CharBuffer* charBuffer ).

virtual int decaf::io::Reader::doReadVector ( std::vector< char > &  buffer)
protectedvirtual

Override this method to customize the functionality of the method read( std::vector<char>& buffer ).

virtual void decaf::io::Reader::mark ( int  readAheadLimit)
virtual

Marks the present position in the stream.

Subsequent calls to reset() will attempt to reposition the stream to this point. Not all character-input streams support the mark() operation.

Parameters
readAheadLimitLimit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail.
Exceptions
IOExceptionif an I/O error occurs, or the stream does not support mark.
virtual bool decaf::io::Reader::markSupported ( ) const
inlinevirtual

Tells whether this stream supports the mark() operation.

The default implementation always returns false. Subclasses should override this method.

Returns
true if and only if this stream supports the mark operation.
virtual int decaf::io::Reader::read ( std::vector< char > &  buffer)
virtual

Reads characters into an array.

This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Parameters
bufferThe buffer to read characters into.
Returns
The number of characters read, or -1 if the end of the stream has been reached
Exceptions
IOExceptionthrown if an I/O error occurs.
virtual int decaf::io::Reader::read ( char *  buffer,
int  size 
)
virtual

Reads characters into an array, the method will attempt to read as much data as the size of the array.

This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Parameters
bufferThe target char buffer.
sizeThe size in bytes of the target buffer.
Returns
The number of bytes read or -1 if the end of stream is reached.
Exceptions
IOExceptionthrown if an I/O error occurs.
NullPointerExceptionif buffer is NULL.
virtual int decaf::io::Reader::read ( char *  buffer,
int  size,
int  offset,
int  length 
)
virtual

Reads characters into a portion of an array.

This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Parameters
bufferThe target char buffer.
sizeThe size in bytes of the target buffer.
offsetThe position in the buffer to start filling.
lengthThe maximum number of bytes to read.
Returns
The number of bytes read or -1 if the end of stream is reached.
Exceptions
IOExceptionthrown if an I/O error occurs.
NullPointerExceptionif buffer is NULL.
IndexOutOfBoundsExceptionif the offset + length is greater than the array size.
virtual int decaf::io::Reader::read ( )
virtual

Reads a single character.

This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.

Subclasses that intend to support efficient single-character input should override this method.

Returns
The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached.
Exceptions
IOExceptionthrown if an I/O error occurs.
virtual int decaf::io::Reader::read ( decaf::nio::CharBuffer charBuffer)
virtual

Attempts to read characters into the specified character buffer.

The buffer is used as a repository of characters as-is: the only changes made are the results of a put operation. No flipping or rewinding of the buffer is performed.

Parameters
charBufferThe Buffer to read Characters into.
Returns
The number of char values added to the buffer, or -1 if this source of characters is at its end
Exceptions
IOExceptionif an I/O error occurs.
NullPointerExceptionif buffer is NULL.
ReadOnlyBufferExceptionif charBuffer is a read only buffer.

Implements decaf::lang::Readable.

virtual bool decaf::io::Reader::ready ( ) const
virtual

Tells whether this stream is ready to be read.

Returns
True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
Exceptions
IOExceptionif an I/O error occurs.

Reimplemented in decaf::io::InputStreamReader.

virtual void decaf::io::Reader::reset ( )
virtual

Resets the stream.

If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().

Exceptions
IOExceptionif an I/O error occurs.
virtual long long decaf::io::Reader::skip ( long long  count)
virtual

Skips characters.

This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.

Parameters
countThe number of character to skip.
Returns
the number of Character actually skipped.
Exceptions
IOExceptionif an I/O error occurs.

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