|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FileInputStream java.net.SocketInputStream
This stream extends FileInputStream to implement a SocketInputStream. Note that this class should NOT be public.
Field Summary | |
private boolean |
closing
Closes the stream. |
private boolean |
eof
|
private PlainSocketImpl |
impl
|
private Socket |
socket
|
private byte[] |
temp
|
Fields inherited from class java.io.FileInputStream |
|
Fields inherited from class java.io.InputStream |
|
Constructor Summary | |
(package private) |
SocketInputStream(PlainSocketImpl impl)
Creates a new SocketInputStream. |
Method Summary | |
int |
available()
Returns the number of bytes that can be read without blocking. |
void |
close()
Closes this file input stream and releases any system resources associated with the stream. |
protected void |
finalize()
Overrides finalize, the fd is closed by the Socket. |
FileChannel |
getChannel()
Returns the unique FileChannel
object associated with this file input stream. |
private static void |
init()
Perform class load-time initializations. |
int |
read()
Reads a single byte from the socket. |
int |
read(byte[] b)
Reads into a byte array data from the socket. |
int |
read(byte[] b,
int off,
int length)
Reads into a byte array b at offset off, length bytes of data. |
(package private) void |
setEOF(boolean eof)
|
long |
skip(long numbytes)
Skips n bytes of input. |
private int |
socketRead0(FileDescriptor fd,
byte[] b,
int off,
int len,
int timeout)
Reads into an array of bytes at the specified offset using the received socket primitive. |
Methods inherited from class java.io.FileInputStream |
getFD |
Methods inherited from class java.io.InputStream |
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean eof
private PlainSocketImpl impl
private byte[] temp
private Socket socket
private boolean closing
Constructor Detail |
SocketInputStream(PlainSocketImpl impl) throws IOException
impl
- the implemented socket input streamMethod Detail |
public final FileChannel getChannel()
FileChannel
object associated with this file input stream.
The getChannel
method of SocketInputStream
returns null
since it is a socket based stream.
getChannel
in class FileInputStream
private int socketRead0(FileDescriptor fd, byte[] b, int off, int len, int timeout) throws IOException
fd
- the FileDescriptorb
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes readtimeout
- the read timeout in ms
IOException
- If an I/O error has occurred.public int read(byte[] b) throws IOException
read
in class FileInputStream
b
- the buffer into which the data is read
IOException
- If an I/O error has occurred.public int read(byte[] b, int off, int length) throws IOException
read
in class FileInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalength
- the maximum number of bytes read.
IOException
- If an I/O error has occurred.public int read() throws IOException
read
in class FileInputStream
-1
if the end of the
file is reached.
IOException
- if an I/O error occurs.public long skip(long numbytes) throws IOException
skip
in class FileInputStream
numbytes
- the number of bytes to be skipped.
IOException
- If an I/O error has occurred.public int available() throws IOException
available
in class FileInputStream
IOException
- if an I/O error occurs.public void close() throws IOException
FileInputStream
If this stream has an associated channel then the channel is closed as well.
close
in class FileInputStream
IOException
- if an I/O error occurs.void setEOF(boolean eof)
protected void finalize()
finalize
in class FileInputStream
FileInputStream.close()
private static void init()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |