code: public OutputContext getSlice(int limit) {
          List<ByteBuffer> newBufs = new LinkedList<ByteBuffer>();
          ByteBuffer buf = ByteBuffer.allocate(limit);
          Iterator<ByteBuffer> iter = buffers.iterator();
  
          while (iter.hasNext() && buf.position() < buf.limit()) {
              ByteBuffer cur = iter.next();
              int diff = buf.limit() - buf.position();
              if (diff > cur.limit()) {
                  buf.put(cur);
                  iter.remove();
              } else {
                  ByteBuffer slice = cur.duplicate();
                  slice.limit(diff);
                  buf.put(slice);
              }
          }
          return new OutputContext(newBufs);
      }
docs: Get an OutputBuffer containing a subset of the current one
  
  @param limit How many bytes should be available
  @return a new OutputContext