| java.lang.Object com.caucho.vfs.StreamImpl com.caucho.vfs.SocketStream
SocketStream | public class SocketStream extends StreamImpl (Code) | | Specialized stream to handle sockets.
Unlike VfsStream, when the read() throws and IOException or
a SocketException, SocketStream will throw a ClientDisconnectException.
|
Method Summary | |
public boolean | canRead() Returns true since the socket stream can be read. | public boolean | canWrite() | public void | close() Closes the underlying sockets and socket streams. | public void | closeWrite() Closes the write half of the stream. | public void | flush() Flushes the socket. | public int | getAvailable() Returns the number of bytes available to be read from the input stream. | public byte[] | getNewline() | public boolean | getThrowReadInterrupts() If true, throws read interrupts instead of returning an end of
fail. | public long | getTotalReadBytes() | public long | getTotalWriteBytes() | public boolean | hasSkip() Returns true if stream is readable and bytes can be skipped. | public void | init(Socket s) Initialize the SocketStream with a new Socket. | public void | init(InputStream is, OutputStream os) Initialize the SocketStream with a new Socket. | public int | read(byte[] buf, int offset, int length) Reads bytes from the socket. | public int | readTimeout(byte[] buf, int offset, int length, long timeout) Reads bytes from the socket. | public void | resetTotalBytes() | public void | setNewline(byte[] newline) | public void | setThrowReadInterrupts(boolean allowThrow) If true, throws read interrupts instead of returning an end of
fail. | public long | skip(long n) Skips bytes in the file. | public void | write(byte[] buf, int offset, int length, boolean isEnd) Writes bytes to the socket.
Parameters: buf - byte buffer containing the bytes Parameters: offset - offset into the buffer Parameters: length - number of bytes to read Parameters: isEnd - if the write is at a close. |
SocketStream | public SocketStream()(Code) | | |
canRead | public boolean canRead()(Code) | | Returns true since the socket stream can be read.
|
canWrite | public boolean canWrite()(Code) | | |
close | public void close() throws IOException(Code) | | Closes the underlying sockets and socket streams.
|
closeWrite | public void closeWrite() throws IOException(Code) | | Closes the write half of the stream.
|
getAvailable | public int getAvailable() throws IOException(Code) | | Returns the number of bytes available to be read from the input stream.
|
getNewline | public byte[] getNewline()(Code) | | |
getThrowReadInterrupts | public boolean getThrowReadInterrupts()(Code) | | If true, throws read interrupts instead of returning an end of
fail. Defaults to false.
|
getTotalReadBytes | public long getTotalReadBytes()(Code) | | |
getTotalWriteBytes | public long getTotalWriteBytes()(Code) | | |
hasSkip | public boolean hasSkip()(Code) | | Returns true if stream is readable and bytes can be skipped.
|
init | public void init(Socket s)(Code) | | Initialize the SocketStream with a new Socket.
Parameters: s - the new socket. |
read | public int read(byte[] buf, int offset, int length) throws IOException(Code) | | Reads bytes from the socket.
Parameters: buf - byte buffer receiving the bytes Parameters: offset - offset into the buffer Parameters: length - number of bytes to read number of bytes read or -1 throws ClientDisconnectException if the connection is dropped |
readTimeout | public int readTimeout(byte[] buf, int offset, int length, long timeout) throws IOException(Code) | | Reads bytes from the socket.
Parameters: buf - byte buffer receiving the bytes Parameters: offset - offset into the buffer Parameters: length - number of bytes to read number of bytes read or -1 throws ClientDisconnectException if the connection is dropped |
resetTotalBytes | public void resetTotalBytes()(Code) | | |
setNewline | public void setNewline(byte[] newline)(Code) | | |
setThrowReadInterrupts | public void setThrowReadInterrupts(boolean allowThrow)(Code) | | If true, throws read interrupts instead of returning an end of
fail. Defaults to false.
|
skip | public long skip(long n) throws IOException(Code) | | Skips bytes in the file.
Parameters: n - the number of bytes to skip the actual bytes skipped. |
write | public void write(byte[] buf, int offset, int length, boolean isEnd) throws IOException(Code) | | Writes bytes to the socket.
Parameters: buf - byte buffer containing the bytes Parameters: offset - offset into the buffer Parameters: length - number of bytes to read Parameters: isEnd - if the write is at a close. throws ClientDisconnectException if the connection is dropped |
Methods inherited from com.caucho.vfs.StreamImpl | public boolean canRead()(Code)(Java Doc) public boolean canWrite()(Code)(Java Doc) public void clearWrite()(Code)(Java Doc) public void close() throws IOException(Code)(Java Doc) public void closeWrite() throws IOException(Code)(Java Doc) public void flush() throws IOException(Code)(Java Doc) public void flushBuffer() throws IOException(Code)(Java Doc) public void flushToDisk() throws IOException(Code)(Java Doc) public Object getAttribute(String name) throws IOException(Code)(Java Doc) public Iterator getAttributeNames() throws IOException(Code)(Java Doc) public int getAvailable() throws IOException(Code)(Java Doc) public boolean getFlushOnNewline()(Code)(Java Doc) public byte[] getNewline()(Code)(Java Doc) public Path getPath()(Code)(Java Doc) public byte[] getReadBuffer()(Code)(Java Doc) public long getReadPosition()(Code)(Java Doc) public boolean hasSkip()(Code)(Java Doc) public int read(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc) public int readNonBlock(byte[] buffer, int offset, int length) throws IOException(Code)(Java Doc) public int readTimeout(byte[] buffer, int offset, int length, long timeout) throws IOException(Code)(Java Doc) public void removeAttribute(String name) throws IOException(Code)(Java Doc) public void seekEnd(long offset) throws IOException(Code)(Java Doc) public void seekStart(long offset) throws IOException(Code)(Java Doc) public void setAttribute(String name, Object value) throws IOException(Code)(Java Doc) public void setPath(Path path)(Code)(Java Doc) public void setWriteEncoding(String encoding)(Code)(Java Doc) public long skip(long n) throws IOException(Code)(Java Doc) public void write(byte[] buffer, int offset, int length, boolean isEnd) throws IOException(Code)(Java Doc) public boolean write(byte[] buf1, int off1, int len1, byte[] buf2, int off2, int len2, boolean isEnd) throws IOException(Code)(Java Doc)
|
|
|