core/src/main/java/com/opentext/ia/sdk/support/io/IOStreams.java
public static void copy(InputStream in, OutputStream out, int bufferSize, HashAssembler hashAssembler)
      throws IOException {
    byte[] buffer = new byte[bufferSize];
    int numRead = Objects.requireNonNull(in, "Missing input").read(buffer);
    if (numRead == 0) {
      throw new IllegalArgumentException("Missing content");
    }
    Objects.requireNonNull(out, "Missing output");
    while (numRead > 0) {
      out.write(buffer, 0, numRead);
      hashAssembler.add(buffer, numRead);
      numRead = in.read(buffer);
    }
  }
public static void copy(InputStream in, OutputStream out, int bufferSize, HashAssembler hashAssembler)
      throws IOException {
    byte[] buffer = new byte[bufferSize];
    int numRead = Objects.requireNonNull(in, "Missing input").read(buffer);
    if (numRead == 0) {
      throw new IllegalArgumentException("Missing content");
    }
    Objects.requireNonNull(out, "Missing output");
    while (numRead > 0) {
      out.write(buffer, 0, numRead);
      hashAssembler.add(buffer, numRead);
      numRead = in.read(buffer);
    }
  }
Utility method to copy the bytes from an InputStream to an OutputStream while also assembling a hash value in the
process.
@param in The source stream
@param out The target stream
@param bufferSize The size of the internal buffer
@param hashAssembler The HashAssembler to use.
@throws IOException if an error occurs when copying the streams