use of org.apache.jackrabbit.oak.segment.SegmentId in project jackrabbit-oak by apache.
the class DefaultStandbySegmentReader method readSegment.
@Override
public byte[] readSegment(String id) {
UUID uuid = UUID.fromString(id);
long msb = uuid.getMostSignificantBits();
long lsb = uuid.getLeastSignificantBits();
SegmentId segmentId = store.getSegmentIdProvider().newSegmentId(msb, lsb);
if (store.containsSegment(segmentId)) {
Segment segment = store.readSegment(segmentId);
try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
segment.writeTo(stream);
return stream.toByteArray();
} catch (IOException e) {
log.warn("Error while reading segment content", e);
return null;
}
}
return null;
}
Aggregations