Package ej.wasi.io.socket
Class WasiSocketInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- ej.wasi.io.socket.WasiSocketInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class WasiSocketInputStream extends FilterInputStream
Input stream used byWasiSocketandWasiSSL
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description WasiSocketInputStream(Socket socket)Creates a newWasiSocketInputStream(Socket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisConnectionReset()Check whether the connection has been reset by the peer.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.voidsetNonBlocking(boolean nonBlockingMode)-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
-
-
-
Constructor Detail
-
WasiSocketInputStream
public WasiSocketInputStream(Socket socket) throws IOException
Creates a newWasiSocketInputStream(Socket)- Parameters:
socket- the underlying socket to be used to read data.- Throws:
IOException
-
-
Method Detail
-
read
public int read(@Nullable byte[] b, int off, int len) throws IOException
Description 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
-
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
-
setNonBlocking
public void setNonBlocking(boolean nonBlockingMode)
-
isConnectionReset
public boolean isConnectionReset() throws IOExceptionCheck whether the connection has been reset by the peer.- Returns:
- connection reset status.
- Throws:
IOException- if an I/O error occurs.
-
-