Package ej.wasi.io
Interface ReadableIO
-
- All Superinterfaces:
AutoCloseable,Closeable,WasiIO
- All Known Subinterfaces:
WasiFile
- All Known Implementing Classes:
WasiFileImpl,WasiFileStub,WasiSocket
public interface ReadableIO extends WasiIO
A readable WasiIO
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intavailable()Returns an estimate of the number of bytes that can be read from this input stream without blocking by the next read method invocation.intread(byte[] buffer, int offset, int length)Readslengthbytes of data from this WasiIO into an array of bytes.voidsetNonBlocking(boolean on)Sets this WasiIO in non blocking state.
-
-
-
Method Detail
-
read
int read(byte[] buffer, int offset, int length) throws IOExceptionReadslengthbytes of data from this WasiIO into an array of bytes.- Parameters:
buffer- the buffer into which the data is read.offset- the start offset in arraybat which the data is written.length- the maximum number of bytes to read.- Returns:
- the total number of bytes read into the buffer or
-1if there is no more data. - Throws:
IOException- if an I/O error occurs.
-
available
int available() throws IOExceptionReturns an estimate of the number of bytes that can be read from this input stream without blocking by the next read method invocation.- Returns:
- an estimate of the number of bytes that can be read from this input
stream without blocking or
0when it reaches the end of this WasiIO. - Throws:
IOException- if an I/O error occurs.
-
setNonBlocking
void setNonBlocking(boolean on) throws IOExceptionSets this WasiIO in non blocking state.- Parameters:
on- whether to enable or disable the non blocking option.- Throws:
IOException- if an I/O error occurs.
-
-