コード例 #1
0
  private static final class FullCodecHandler implements CodecHandler {
    private final TempBufferHolder _bufH =
        TempBufferHolder.newHolder(TempBufferHolder.Type.HARD, true);
    private final PageChannel _channel;

    private FullCodecHandler(PageChannel channel) {
      _channel = channel;
    }

    public boolean canEncodePartialPage() {
      return false;
    }

    public boolean canDecodeInline() {
      return true;
    }

    public void decodePage(ByteBuffer inPage, ByteBuffer outPage, int pageNumber)
        throws IOException {
      byte[] arr = inPage.array();
      fullDecode(arr, arr, pageNumber);
    }

    public ByteBuffer encodePage(ByteBuffer page, int pageNumber, int pageOffset)
        throws IOException {
      assertEquals(0, pageOffset);
      assertEquals(_channel.getFormat().PAGE_SIZE, page.limit());

      ByteBuffer bb = _bufH.getPageBuffer(_channel);
      bb.clear();
      fullEncode(page.array(), bb.array(), pageNumber);
      return bb;
    }
  }
コード例 #2
0
 public ByteBuffer encodePage(ByteBuffer page, int pageNumber, int pageOffset)
     throws IOException {
   ByteBuffer bb = _bufH.getPageBuffer(_channel);
   bb.clear();
   simpleEncode(page.array(), bb.array(), pageNumber, pageOffset, page.limit());
   return bb;
 }
コード例 #3
0
    public ByteBuffer encodePage(ByteBuffer page, int pageNumber, int pageOffset)
        throws IOException {
      assertEquals(0, pageOffset);
      assertEquals(_channel.getFormat().PAGE_SIZE, page.limit());

      ByteBuffer bb = _bufH.getPageBuffer(_channel);
      bb.clear();
      fullEncode(page.array(), bb.array(), pageNumber);
      return bb;
    }