use of org.apache.bookkeeper.proto.checksum.DigestManager in project bookkeeper by apache.
the class MockBookKeeperTestCase method extractEntryPayload.
private byte[] extractEntryPayload(long ledgerId, long entryId, ByteBufList toSend) throws BKException.BKDigestMatchException {
ByteBuf toSendCopy = Unpooled.copiedBuffer(toSend.toArray());
toSendCopy.resetReaderIndex();
DigestManager macManager = null;
try {
macManager = getDigestType(ledgerId);
} catch (GeneralSecurityException gse) {
LOG.error("Initialize macManager fail", gse);
}
ByteBuf content = macManager.verifyDigestAndReturnData(entryId, toSendCopy);
byte[] entry = new byte[content.readableBytes()];
content.readBytes(entry);
content.resetReaderIndex();
content.release();
return entry;
}
Aggregations