code: public static ByteBuffer slice(ByteBuffer buf, int off, int len)
  	{
  		ByteBuffer localBuf=buf.duplicate();	// so we don't mess up the position,etc
  		logger.debug("off={} len={}", off, len);
  		localBuf.position(off);
  		localBuf.limit(off+len);
  		logger.debug("pre-slice: localBuf.position()={} localBuf.limit()={}", localBuf.position(), localBuf.limit());
  		localBuf = localBuf.slice();
  		logger.debug("post-slice: localBuf.position()={} localBuf.limit()={}", localBuf.position(), localBuf.limit());
  		return localBuf;
  	}
docs: Sane ByteBuffer slice
  @param buf the buffer to slice something out of
  @param off The offset into the buffer
  @param len the length of the part to slice out