code: public final static int put(IoBuffer out, IoBuffer in, int numBytesMax) {
          if (log.isTraceEnabled()) {
              log.trace("Put\nin buffer: {}\nout buffer: {}\nmax bytes: {}", new Object[] { out, in, numBytesMax });
          }
          int numBytesRead = 0;
          if (in != null) {
              int limit = Math.min(in.limit(), numBytesMax);
              byte[] inBuf = new byte[limit];
              log.trace("Bulk get size: {}", limit);
              in.get(inBuf);
              byte[] outBuf = consumeBytes(inBuf, numBytesMax);
              out.put(outBuf);
              numBytesRead = outBuf.length;
              log.trace("In pos: {}", in.position());
          }
          log.trace("Bytes put: {}", numBytesRead);
          return numBytesRead;
      }
docs: Puts an input buffer in an output buffer and returns number of bytes written.
  
  @param out
  Output buffer
  @param in
  Input buffer
  @param numBytesMax
  Number of bytes max
  @return int Number of bytes written