|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.net.SocketInputStream
public class SocketInputStream
JControl Implementation of a SocketInputStream
Constructor Summary | |
---|---|
protected |
SocketInputStream(Socket socket)
Constructor should only be initiated by the socket-class |
Method Summary | |
---|---|
int |
available()
not implemented for network streams |
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
protected void |
finalize()
Free internal data structures used by this socketinputstream object. |
void |
mark(int readlimit)
NOTE: not supported! |
boolean |
markSupported()
NOTE: not supported! |
int |
read()
Reads the next byte of data from the input stream. |
int |
read(byte[] b)
Reads some number of bytes from the input stream and stores them into the buffer array b . |
int |
read(byte[] buffer,
int offset,
int length)
Reads up to len bytes of data from the input stream into an array of bytes. |
void |
reset()
NOTE: not supported! |
int |
skip(int n)
not implemented for network streams |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Constructor Detail |
---|
protected SocketInputStream(Socket socket)
socket
- Method Detail |
---|
public int read() throws IOException
read
in interface BasicInputStream
IOException
- - if an I/O error occurs.public int read(byte[] b) throws IOException
BasicInputStream
b
. The number of bytes actually read is
returned as an integer. This method blocks until input data is
available, end of file is detected, or an exception is thrown.
If b
is null
, a
NullPointerException
is thrown. If the length of
b
is zero, then no bytes are read and 0
is
returned; otherwise, there is an attempt to read at least one byte. If
no byte is available because the stream is at end of file, the value
-1
is returned; otherwise, at least one byte is read and
stored into b
.
The first byte read is stored into element b[0]
, the
next one into b[1]
, and so on. The number of bytes read is,
at most, equal to the length of b
. Let k be the
number of bytes actually read; these bytes will be stored in elements
b[0]
through b[
k-1]
,
leaving elements b[
k]
through
b[b.length-1]
unaffected.
If the first byte cannot be read for any reason other than end of
file, then an IOException
is thrown. In particular, an
IOException
is thrown if the input stream has been closed.
The read(b)
method for class InputStream
has the same effect as:
read(b, 0, b.length)
read
in interface BasicInputStream
b
- the buffer into which the data is read.
-1
is there is no more data because the end of
the stream has been reached.
IOException
- if an I/O error occurs.read(byte[] buffer, int offset, int length)
public int read(byte[] buffer, int offset, int length) throws IOException
read
in interface BasicInputStream
buffer
- - the buffer into which the data is read.offset
- - the start offset in array b at which the data is written.length
- - the maximum number of bytes to read.
IOException
- - if an I/O error occurs.
NullPointerException
- - if buffer is null.InputStream.read()
public void close() throws IOException
close
in interface BasicInputStream
IOException
- - if an I/O error occurs.public int available() throws IOException
available
in interface BasicInputStream
IOException
- if an I/O error occurs.public int skip(int n) throws IOException
skip
in interface BasicInputStream
n
- the number of bytes to be skipped.
IOException
- if an I/O error occurs.protected void finalize()
public void mark(int readlimit)
mark
in interface BasicInputStream
readlimit
- the maximum limit of bytes that can be read before
the mark position becomes invalid.public boolean markSupported()
markSupported
in interface BasicInputStream
true
if this stream instance supports the mark
and reset methods; false
otherwise.public void reset() throws IOException
reset
in interface BasicInputStream
IOException
- if this stream has not been makred or if the
mark has been invalidated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |