Class InputStreams

java.lang.Object
io.bytestreams.codec.core.util.InputStreams

public final class InputStreams extends Object
Utility methods for working with input streams.
  • Method Details

    • readFully

      public static byte[] readFully(InputStream input, int length) throws IOException
      Reads exactly the specified number of bytes from the input stream.
      Parameters:
      input - the input stream to read from
      length - the exact number of bytes to read
      Returns:
      a byte array containing the bytes read
      Throws:
      IllegalArgumentException - if length is negative
      IOException - if an I/O error occurs
      EOFException - if the stream ends before the required bytes are read