// FileEntry is immutable, so its members can't be changed by another thread.
fe.unlock();
}
if (trace) log.tracef("Read entry %s at %d:%d", key, fe.offset, fe.actualSize());
ByteBufferFactory factory = ctx.getByteBufferFactory();
org.infinispan.commons.io.ByteBuffer keyBb = factory.newByteBuffer(data, 0, fe.keyLen);
org.infinispan.commons.io.ByteBuffer valueBb = null;
org.infinispan.commons.io.ByteBuffer metadataBb = null;
if (loadValue) {
valueBb = factory.newByteBuffer(data, fe.keyLen, fe.dataLen);
}
if (loadMetadata && fe.metadataLen > 0) {
metadataBb = factory.newByteBuffer(data, fe.keyLen + fe.dataLen, fe.metadataLen);
}
return ctx.getMarshalledEntryFactory().newMarshalledEntry(keyBb, valueBb, metadataBb);
}