Package com.ngrok.net

Class ConnectionInputStream

    • Constructor Detail

      • ConnectionInputStream

        public ConnectionInputStream​(Connection connection,
                                     int bufferSize)
        Creates a new input stream for the given connection with the specified buffer size.
        Parameters:
        connection - the connection to read from
        bufferSize - the size of the buffer to use to read data from the connection
    • Method Detail

      • read

        public int read()
                 throws IOException
        Reads a single byte of data from the input stream.
        Specified by:
        read in class InputStream
        Returns:
        the byte of data, or -1 if the end of the stream has been reached
        Throws:
        IOException - if an I/O error occurs
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws IOException
        Reads up to len bytes of data from the input stream into an array of bytes.
        Overrides:
        read in class InputStream
        Parameters:
        b - the array of bytes to read the data into
        off - the offset within the buffer to start reading the data from
        len - the maximum number of bytes to read
        Returns:
        the total number of bytes read into the buffer, or -1 if the end of the stream has been reached
        Throws:
        IOException - if an I/O error occurs