code: private void copy(final InputStream in, final SeekableByteChannel out) throws IOException {
          assert in != null : "InStream must be specified";
          assert out != null : "Channel must be specified";
  
          final byte[] backingBuffer = new byte[1024 * 4];
          final ByteBuffer byteBuffer = ByteBuffer.wrap(backingBuffer);
          int bytesRead = 0;
          while ((bytesRead = in.read(backingBuffer, 0, backingBuffer.length)) > -1) {
              // Limit to the amount we've actually read in, so we don't overflow into old data blocks
              byteBuffer.limit(bytesRead);
              out.write(byteBuffer);
              // Position back to 0
              byteBuffer.clear();
          }
      }
docs: Writes the contents of the {@link InputStream} to the {@link SeekableByteChannel}
  
  @param in
  @param out
  @throws IOException