code: public static ByteBuffer readBytes(ByteBuffer bb, int length)
      {
          ByteBuffer copy = bb.duplicate();
          copy.limit(copy.position() + length);
          bb.position(bb.position() + length);
          return copy;
      }
docs: changes bb position