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; } }
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; }
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; }