Package com.microej.kf.util.control.net
Class SocketInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.microej.kf.util.control.net.SocketInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class SocketInputStream extends FilterInputStream
Socket input stream wrapper used to control net/ssl read call.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description SocketInputStream(Socket socket, InputStream inputstream)Creates a socket input stream instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this input stream and releases any system resources associated with the stream.intread()Reads the next byte of data from this input stream.intread(byte[] b, int off, int len)Reads up tolenbytes of data from this input stream into an array of bytes.-
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
-
-
-
-
Constructor Detail
-
SocketInputStream
public SocketInputStream(Socket socket, InputStream inputstream) throws IOException
Creates a socket input stream instance.- Parameters:
socket- the socket.inputstream- the underlying input stream.- Throws:
IOException- if an error occurs.
-
-
Method Detail
-
read
public int read() throws IOExceptionDescription copied from class:FilterInputStreamReads the next byte of data from this input stream. The value byte is returned as anintin the range0to255. If no byte is available because the end of the stream has been reached, the value-1is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.This method simply performs
in.read()and returns the result.- Overrides:
readin classFilterInputStream- Returns:
- the next byte of data, or
-1if the end of the stream is reached. - Throws:
IOException- if an I/O error occurs.- See Also:
FilterInputStream.in
-
read
public int read(byte[] b, int off, int len) throws IOExceptionDescription copied from class:FilterInputStreamReads up tolenbytes of data from this input stream into an array of bytes. Iflenis not zero, the method blocks until some input is available; otherwise, no bytes are read and0is returned.This method simply performs
in.read(b, off, len)and returns the result.- Overrides:
readin classFilterInputStream- Parameters:
b- the buffer into which the data is read.off- the start offset in the destination arrayblen- the maximum number of bytes read.- Returns:
- the total number of bytes read into the buffer, or
-1if there is no more data because the end of the stream has been reached. - Throws:
IOException- if an I/O error occurs.- See Also:
FilterInputStream.in
-
close
public void close() throws IOExceptionDescription copied from class:FilterInputStreamCloses this input stream and releases any system resources associated with the stream. This method simply performsin.close().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException- if an I/O error occurs.- See Also:
FilterInputStream.in
-
-