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

An InputStreamReader is a bridge from byte streams to character streams. More...

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

Inheritance diagram for decaf::io::InputStreamReader:

Public Member Functions

 InputStreamReader (InputStream *stream, bool own=false)
 Create a new InputStreamReader that wraps the given InputStream.
virtual ~InputStreamReader ()
virtual void close ()
 Closes this object and deallocates the appropriate resources.
virtual bool ready () const
 Tells whether this stream is ready to be read.
- Public Member Functions inherited from decaf::io::Reader
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 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 ()
- Public Member Functions inherited from decaf::lang::Readable
virtual ~Readable ()

Protected Member Functions

virtual int doReadArrayBounded (char *buffer, int size, int offset, int length)
 Override this method to customize the functionality of the method read( unsigned char* buffer, int size, int offset, int length ).
virtual void checkClosed () const
- Protected Member Functions inherited from decaf::io::Reader
 Reader ()
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 ).

Detailed Description

An InputStreamReader is a bridge from byte streams to character streams.

For top efficiency, consider wrapping an InputStreamReader within a BufferedReader. For example:

BufferedReader* in = new BufferedReader( new InputStreamReader( System.in, false ), true );

See Also
OutputStreamWriter
Since
1.0

Constructor & Destructor Documentation

decaf::io::InputStreamReader::InputStreamReader ( InputStream stream,
bool  own = false 
)

Create a new InputStreamReader that wraps the given InputStream.

Parameters
streamThe InputStream to read from. (cannot be null).
ownDoes this object own the passed InputStream (defaults to false).
Exceptions
NullPointerExceptionif the passed InputStream is NULL.
virtual decaf::io::InputStreamReader::~InputStreamReader ( )
virtual

Member Function Documentation

virtual void decaf::io::InputStreamReader::checkClosed ( ) const
protectedvirtual
virtual void decaf::io::InputStreamReader::close ( )
virtual

Closes this object and deallocates the appropriate resources.

The object is generally no longer usable after calling close.

Exceptions
IOExceptionif an error occurs while closing.

Implements decaf::io::Closeable.

virtual int decaf::io::InputStreamReader::doReadArrayBounded ( char *  buffer,
int  size,
int  offset,
int  length 
)
protectedvirtual

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.

Implements decaf::io::Reader.

virtual bool decaf::io::InputStreamReader::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 from decaf::io::Reader.


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