code: public long transferFrom(InputStream is)
              throws IOException
      {
          if (closed) {
              throw new ClosedChannelException();
          }
  
          if (is == null) {
              throw new NullPointerException();
          }
  
          if (buffer.remaining() == 0) {
              flushBuffer();
          }
  
          assert buffer.hasArray();
          final byte[] bytes = buffer.array();
  
          final int arrayOffset = buffer.arrayOffset();
          long totTransfered = 0;
          int read;
          while ((read = is.read(bytes, arrayOffset + buffer.position(),
                  buffer.remaining())) != -1) {
              buffer.position(buffer.position() + read);
  
              if (buffer.remaining() == 0) {
                  flushBuffer();
              }
  
              totTransfered += read;
          }
  
          return totTransfered;
      }
docs: Transfers all the content from <i>is</i> to this {@link OutputStream}.
  This potentially limits the amount of buffering required to compress
  content.
  
  @param is The source of data to compress.
  @return The number of bytes read from <i>is</i>.
  @throws IOException
  @since 1.1.1