Save This Page
Home » openjdk-7 » java » net » [javadoc | source]
java.net
class: SocketInputStream [javadoc | source]
java.lang.Object
   java.io.InputStream
      java.io.FileInputStream
         java.net.SocketInputStream

All Implemented Interfaces:
    Closeable

This stream extends FileInputStream to implement a SocketInputStream. Note that this class should NOT be public.
Constructor:
 SocketInputStream(AbstractPlainSocketImpl impl) throws IOException 
    Creates a new SocketInputStream. Can only be called by a Socket. This method needs to hang on to the owner Socket so that the fd will not be closed.
    Parameters:
    impl - the implemented socket input stream
Method from java.net.SocketInputStream Summary:
available,   close,   finalize,   getChannel,   read,   read,   read,   read,   setEOF,   skip
Methods from java.io.FileInputStream:
available,   close,   finalize,   getChannel,   getFD,   read,   read,   read,   skip
Methods from java.io.InputStream:
available,   close,   mark,   markSupported,   read,   read,   read,   reset,   skip
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.net.SocketInputStream Detail:
 public int available() throws IOException 
    Returns the number of bytes that can be read without blocking.
 public  void close() throws IOException 
 protected  void finalize() 
    Overrides finalize, the fd is closed by the Socket.
 public final FileChannel getChannel() 
    Returns the unique FileChannel object associated with this file input stream.

    The getChannel method of SocketInputStream returns null since it is a socket based stream.

 public int read() throws IOException 
    Reads a single byte from the socket.
 public int read(byte[] b) throws IOException 
    Reads into a byte array data from the socket.
 public int read(byte[] b,
    int off,
    int length) throws IOException 
    Reads into a byte array b at offset off, length bytes of data.
 int read(byte[] b,
    int off,
    int length,
    int timeout) throws IOException 
  void setEOF(boolean eof) 
 public long skip(long numbytes) throws IOException 
    Skips n bytes of input.