Index: oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.java (date 1491922800000) +++ oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.java (date 1492013003000) @@ -55,7 +55,7 @@ private final RecordId recordId; - private final byte[] inline; + private final ByteBuffer inline; private final ListRecord blocks; @@ -75,9 +75,7 @@ SegmentStream(RecordId recordId, ByteBuffer inline, int length) { this.recordId = checkNotNull(recordId); - // TODO rewrite this class to leverage the ByteBuffer apis - this.inline = new byte[length]; - inline.get(this.inline); + this.inline = inline.duplicate(); this.blocks = null; this.length = length; } @@ -96,7 +94,7 @@ public String getString() { if (inline != null) { - return new String(inline, Charsets.UTF_8); + return Charsets.UTF_8.decode(inline).toString(); } else if (length > Integer.MAX_VALUE) { throw new IllegalStateException("Too long value: " + length); } else { @@ -154,7 +152,7 @@ } if (inline != null) { - System.arraycopy(inline, (int) position, b, off, len); + inline.get(b, off, len); } else { int blockIndex = (int) (position / BLOCK_SIZE); int blockOffset = (int) (position % BLOCK_SIZE);