Input stream for performing reads on a socket.
More...
#include <src/main/decaf/internal/net/tcp/TcpSocketInputStream.h>
Public Member Functions |
| TcpSocketInputStream (TcpSocket *socket) |
| Create a new InputStream to use for reading from the TCP/IP socket.
|
virtual | ~TcpSocketInputStream () |
virtual int | available () const |
| Indicates the number of bytes available.The default implementation of this methods returns 0. Classes that override this method may return the total number of bytes that are currently available for reading and others may simply return a value of one indicating that there is some data avaiable. The caller should view the result of this method as an absolute.The default implementation of this method returns zero.- Returns
- the number of bytes available on this input stream.
- Exceptions
-
|
virtual void | close () |
| Close - does nothing.
|
virtual long long | skip (long long num) |
| Not supported.
|
| InputStream () |
virtual | ~InputStream () |
virtual void | mark (int readLimit) |
| Marks the current position in the stream A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.
|
virtual void | reset () |
| Repositions this stream to the position at the time the mark method was last called on this input stream.
|
virtual bool | markSupported () const |
| Determines if this input stream supports the mark and reset methods.
|
virtual int | read () |
| Reads a single byte from the buffer.
|
virtual int | read (unsigned char *buffer, int size) |
| Reads up to size bytes of data from the input stream into an array of bytes.
|
virtual int | read (unsigned char *buffer, int size, int offset, int length) |
| Reads up to length bytes of data from the input stream into an array of bytes.
|
virtual std::string | toString () const |
| Output a String representation of this object.
|
virtual void | lock () |
| Locks the object.
|
virtual bool | tryLock () |
| Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
|
virtual void | unlock () |
| Unlocks the object.
|
virtual void | wait () |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | wait (long long millisecs) |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | wait (long long millisecs, int nanos) |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | notify () |
| Signals a waiter on this object that it can now wake up and continue.
|
virtual void | notifyAll () |
| Signals the waiters on this object that it can now wake up and continue.
|
virtual | ~Closeable () |
virtual | ~Synchronizable () |
Protected Member Functions |
virtual int | doReadByte () |
virtual int | doReadArrayBounded (unsigned char *buffer, int size, int offset, int length) |
virtual int | doReadArray (unsigned char *buffer, int size) |
Detailed Description
Input stream for performing reads on a socket.
This class will only work properly for blocking sockets.
- Since
- 1.0
Constructor & Destructor Documentation
decaf::internal::net::tcp::TcpSocketInputStream::TcpSocketInputStream |
( |
TcpSocket * |
socket | ) |
|
Create a new InputStream to use for reading from the TCP/IP socket.
- Parameters
-
socket | The parent SocketImpl for this stream. |
virtual decaf::internal::net::tcp::TcpSocketInputStream::~TcpSocketInputStream |
( |
| ) |
|
|
virtual |
Member Function Documentation
virtual int decaf::internal::net::tcp::TcpSocketInputStream::available |
( |
| ) |
const |
|
virtual |
Indicates the number of bytes available.The default implementation of this methods returns 0. Classes that override this method may return the total number of bytes that are currently available for reading and others may simply return a value of one indicating that there is some data avaiable. The caller should view the result of this method as an absolute.The default implementation of this method returns zero.
- Returns
- the number of bytes available on this input stream.
- Exceptions
-
Reimplemented from decaf::io::InputStream.
virtual void decaf::internal::net::tcp::TcpSocketInputStream::close |
( |
| ) |
|
|
virtual |
Close - does nothing.
It is the responsibility of the owner of the socket object to close it.
Closes the InputStream freeing any resources that might have been acquired during the lifetime of this stream.The default implementation of this method does nothing.
- Exceptions
-
Reimplemented from decaf::io::InputStream.
virtual int decaf::internal::net::tcp::TcpSocketInputStream::doReadArrayBounded |
( |
unsigned char * |
buffer, |
|
|
int |
size, |
|
|
int |
offset, |
|
|
int |
length |
|
) |
| |
|
protectedvirtual |
virtual int decaf::internal::net::tcp::TcpSocketInputStream::doReadByte |
( |
| ) |
|
|
protectedvirtual |
virtual long long decaf::internal::net::tcp::TcpSocketInputStream::skip |
( |
long long |
num | ) |
|
|
virtual |
Not supported.
Skips over and discards n bytes of data from this input stream.The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned.The skip method of InputStream creates a byte array and then repeatedly reads into it until num bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.
- Parameters
-
num | The number of bytes to skip. |
- Returns
- total bytes skipped
- Exceptions
-
IOException | if an I/O error occurs. |
UnsupportedOperationException | if the concrete stream class does not support skipping bytes. |
Reimplemented from decaf::io::InputStream.
The documentation for this class was generated from the following file: