Package ej.wasi.io

Interface ReadableIO

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int available()
      Returns an estimate of the number of bytes that can be read from this input stream without blocking by the next read method invocation.
      int read​(byte[] buffer, int offset, int length)
      Reads length bytes of data from this WasiIO into an array of bytes.
      void setNonBlocking​(boolean on)
      Sets this WasiIO in non blocking state.
    • Method Detail

      • read

        int read​(byte[] buffer,
                 int offset,
                 int length)
          throws IOException
        Reads length bytes 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 array b at which the data is written.
        length - the maximum number of bytes to read.
        Returns:
        the total number of bytes read into the buffer or -1 if there is no more data.
        Throws:
        IOException - if an I/O error occurs.
      • available

        int available()
               throws IOException
        Returns 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 0 when it reaches the end of this WasiIO.
        Throws:
        IOException - if an I/O error occurs.
      • setNonBlocking

        void setNonBlocking​(boolean on)
                     throws IOException
        Sets 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.