Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java
 Wed Dec  5 17:00:25 2018
@@ -31,7 +31,6 @@ import static org.apache.jackrabbit.oak.
 
 import java.io.Closeable;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -39,6 +38,7 @@ import java.util.UUID;
 import java.util.zip.CRC32;
 
 import 
org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexWriter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveWriter;
 import org.apache.jackrabbit.oak.stats.CounterStats;
@@ -127,7 +127,7 @@ class TarWriter implements Closeable {
      * @param lsb the least significant bits of the segment id
      * @return the byte buffer, or null if not in this file
      */
-    ByteBuffer readEntry(long msb, long lsb) throws IOException {
+    Buffer readEntry(long msb, long lsb) throws IOException {
         synchronized (this) {
             checkState(!closed);
         }
@@ -279,7 +279,7 @@ class TarWriter implements Closeable {
             graphSize += 16 * entry.getValue().size();
         }
 
-        ByteBuffer buffer = ByteBuffer.allocate(graphSize);
+        Buffer buffer = Buffer.allocate(graphSize);
 
         for (Entry<UUID, Set<UUID>> entry : graph.entrySet()) {
             UUID from = entry.getKey();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoader.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoader.java
 Wed Dec  5 17:00:25 2018
@@ -18,8 +18,8 @@
 package org.apache.jackrabbit.oak.segment.file.tar.binaries;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
 
 public class BinaryReferencesIndexLoader {
@@ -41,7 +41,7 @@ public class BinaryReferencesIndexLoader
      * @throws InvalidBinaryReferencesIndexException if the index is invalid or
      *                                               malformed.
      */
-    public static ByteBuffer loadBinaryReferencesIndex(ReaderAtEnd reader) 
throws IOException, InvalidBinaryReferencesIndexException {
+    public static Buffer loadBinaryReferencesIndex(ReaderAtEnd reader) throws 
IOException, InvalidBinaryReferencesIndexException {
         switch (readMagic(reader)) {
             case BinaryReferencesIndexLoaderV1.MAGIC:
                 return 
BinaryReferencesIndexLoaderV1.loadBinaryReferencesIndex(reader);
@@ -52,7 +52,7 @@ public class BinaryReferencesIndexLoader
         }
     }
 
-    public static BinaryReferencesIndex parseBinaryReferencesIndex(ByteBuffer 
buffer) throws InvalidBinaryReferencesIndexException {
+    public static BinaryReferencesIndex parseBinaryReferencesIndex(Buffer 
buffer) throws InvalidBinaryReferencesIndexException {
         switch (readMagic(buffer)) {
             case BinaryReferencesIndexLoaderV1.MAGIC:
                 return 
BinaryReferencesIndexLoaderV1.parseBinaryReferencesIndex(buffer);
@@ -67,7 +67,7 @@ public class BinaryReferencesIndexLoader
         return reader.readAtEnd(Integer.BYTES, Integer.BYTES).getInt();
     }
 
-    private static int readMagic(ByteBuffer buffer) {
+    private static int readMagic(Buffer buffer) {
         buffer.position(buffer.limit() - Integer.BYTES);
         int magic = buffer.getInt();
         buffer.rewind();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1.java
 Wed Dec  5 17:00:25 2018
@@ -18,7 +18,6 @@
 package org.apache.jackrabbit.oak.segment.file.tar.binaries;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -27,6 +26,7 @@ import java.util.UUID;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
 
 class BinaryReferencesIndexLoaderV1 {
@@ -35,8 +35,8 @@ class BinaryReferencesIndexLoaderV1 {
 
     static final int FOOTER_SIZE = 16;
 
-    static ByteBuffer loadBinaryReferencesIndex(ReaderAtEnd reader) throws 
IOException, InvalidBinaryReferencesIndexException {
-        ByteBuffer meta = reader.readAtEnd(FOOTER_SIZE, FOOTER_SIZE);
+    static Buffer loadBinaryReferencesIndex(ReaderAtEnd reader) throws 
IOException, InvalidBinaryReferencesIndexException {
+        Buffer meta = reader.readAtEnd(FOOTER_SIZE, FOOTER_SIZE);
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -56,12 +56,12 @@ class BinaryReferencesIndexLoaderV1 {
         return reader.readAtEnd(size, size);
     }
 
-    public static BinaryReferencesIndex parseBinaryReferencesIndex(ByteBuffer 
buffer) throws InvalidBinaryReferencesIndexException {
-        ByteBuffer data = buffer.slice();
+    public static BinaryReferencesIndex parseBinaryReferencesIndex(Buffer 
buffer) throws InvalidBinaryReferencesIndexException {
+        Buffer data = buffer.slice();
         data.limit(data.limit() - FOOTER_SIZE);
 
         buffer.position(buffer.limit() - FOOTER_SIZE);
-        ByteBuffer meta = buffer.slice();
+        Buffer meta = buffer.slice();
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -80,7 +80,7 @@ class BinaryReferencesIndexLoaderV1 {
 
         CRC32 checksum = new CRC32();
         data.mark();
-        checksum.update(data);
+        data.update(checksum);
         data.reset();
 
         if ((int) (checksum.getValue()) != crc32) {
@@ -90,7 +90,7 @@ class BinaryReferencesIndexLoaderV1 {
         return new BinaryReferencesIndex(parseBinaryReferencesIndex(count, 
data));
     }
 
-    private static Map<Generation, Map<UUID, Set<String>>> 
parseBinaryReferencesIndex(int count, ByteBuffer buffer) {
+    private static Map<Generation, Map<UUID, Set<String>>> 
parseBinaryReferencesIndex(int count, Buffer buffer) {
         Map<Generation, Map<UUID, Set<String>>> result = new HashMap<>(count);
         for (int i = 0; i < count; i++) {
             Generation k = parseGeneration(buffer);
@@ -100,16 +100,16 @@ class BinaryReferencesIndexLoaderV1 {
         return result;
     }
 
-    private static Generation parseGeneration(ByteBuffer buffer) {
+    private static Generation parseGeneration(Buffer buffer) {
         int generation = buffer.getInt();
         return new Generation(generation, generation, true);
     }
 
-    private static Map<UUID, Set<String>> parseEntriesBySegment(ByteBuffer 
buffer) {
+    private static Map<UUID, Set<String>> parseEntriesBySegment(Buffer buffer) 
{
         return parseEntriesBySegment(buffer.getInt(), buffer);
     }
 
-    private static Map<UUID, Set<String>> parseEntriesBySegment(int count, 
ByteBuffer buffer) {
+    private static Map<UUID, Set<String>> parseEntriesBySegment(int count, 
Buffer buffer) {
         Map<UUID, Set<String>> result = new HashMap<>(count);
         for (int i = 0; i < count; i++) {
             UUID k = parseUUID(buffer);
@@ -119,17 +119,17 @@ class BinaryReferencesIndexLoaderV1 {
         return result;
     }
 
-    private static UUID parseUUID(ByteBuffer buffer) {
+    private static UUID parseUUID(Buffer buffer) {
         long msb = buffer.getLong();
         long lsb = buffer.getLong();
         return new UUID(msb, lsb);
     }
 
-    private static Set<String> parseEntries(ByteBuffer buffer) {
+    private static Set<String> parseEntries(Buffer buffer) {
         return parseEntries(buffer.getInt(), buffer);
     }
 
-    private static Set<String> parseEntries(int count, ByteBuffer buffer) {
+    private static Set<String> parseEntries(int count, Buffer buffer) {
         Set<String> entries = new HashSet<>(count);
         for (int i = 0; i < count; i++) {
             entries.add(parseString(buffer));
@@ -137,11 +137,11 @@ class BinaryReferencesIndexLoaderV1 {
         return entries;
     }
 
-    private static String parseString(ByteBuffer buffer) {
+    private static String parseString(Buffer buffer) {
         return parseString(buffer.getInt(), buffer);
     }
 
-    private static String parseString(int length, ByteBuffer buffer) {
+    private static String parseString(int length, Buffer buffer) {
         byte[] data = new byte[length];
         buffer.get(data);
         return new String(data, Charsets.UTF_8);

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2.java
 Wed Dec  5 17:00:25 2018
@@ -18,7 +18,6 @@
 package org.apache.jackrabbit.oak.segment.file.tar.binaries;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -27,6 +26,7 @@ import java.util.UUID;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
 
 class BinaryReferencesIndexLoaderV2 {
@@ -35,8 +35,8 @@ class BinaryReferencesIndexLoaderV2 {
 
     static final int FOOTER_SIZE = 16;
 
-    static ByteBuffer loadBinaryReferencesIndex(ReaderAtEnd reader) throws 
IOException, InvalidBinaryReferencesIndexException {
-        ByteBuffer meta = reader.readAtEnd(FOOTER_SIZE, FOOTER_SIZE);
+    static Buffer loadBinaryReferencesIndex(ReaderAtEnd reader) throws 
IOException, InvalidBinaryReferencesIndexException {
+        Buffer meta = reader.readAtEnd(FOOTER_SIZE, FOOTER_SIZE);
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -56,12 +56,12 @@ class BinaryReferencesIndexLoaderV2 {
         return reader.readAtEnd(size, size);
     }
 
-    public static BinaryReferencesIndex parseBinaryReferencesIndex(ByteBuffer 
buffer) throws InvalidBinaryReferencesIndexException {
-        ByteBuffer data = buffer.slice();
+    public static BinaryReferencesIndex parseBinaryReferencesIndex(Buffer 
buffer) throws InvalidBinaryReferencesIndexException {
+        Buffer data = buffer.slice();
         data.limit(data.limit() - FOOTER_SIZE);
 
         buffer.position(buffer.limit() - FOOTER_SIZE);
-        ByteBuffer meta = buffer.slice();
+        Buffer meta = buffer.slice();
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -80,7 +80,7 @@ class BinaryReferencesIndexLoaderV2 {
 
         CRC32 checksum = new CRC32();
         data.mark();
-        checksum.update(data);
+        data.update(checksum);
         data.reset();
 
         if ((int) (checksum.getValue()) != crc32) {
@@ -90,7 +90,7 @@ class BinaryReferencesIndexLoaderV2 {
         return new BinaryReferencesIndex(parseBinaryReferencesIndex(count, 
data));
     }
 
-    private static Map<Generation, Map<UUID, Set<String>>> 
parseBinaryReferencesIndex(int count, ByteBuffer buffer) {
+    private static Map<Generation, Map<UUID, Set<String>>> 
parseBinaryReferencesIndex(int count, Buffer buffer) {
         Map<Generation, Map<UUID, Set<String>>> result = new HashMap<>(count);
         for (int i = 0; i < count; i++) {
             Generation k = parseGeneration(buffer);
@@ -100,18 +100,18 @@ class BinaryReferencesIndexLoaderV2 {
         return result;
     }
 
-    private static Generation parseGeneration(ByteBuffer buffer) {
+    private static Generation parseGeneration(Buffer buffer) {
         int generation = buffer.getInt();
         int full = buffer.getInt();
         boolean compacted = buffer.get() != 0;
         return new Generation(generation, full, compacted);
     }
 
-    private static Map<UUID, Set<String>> parseEntriesBySegment(ByteBuffer 
buffer) {
+    private static Map<UUID, Set<String>> parseEntriesBySegment(Buffer buffer) 
{
         return parseEntriesBySegment(buffer.getInt(), buffer);
     }
 
-    private static Map<UUID, Set<String>> parseEntriesBySegment(int count, 
ByteBuffer buffer) {
+    private static Map<UUID, Set<String>> parseEntriesBySegment(int count, 
Buffer buffer) {
         Map<UUID, Set<String>> result = new HashMap<>(count);
         for (int i = 0; i < count; i++) {
             UUID k = parseUUID(buffer);
@@ -121,17 +121,17 @@ class BinaryReferencesIndexLoaderV2 {
         return result;
     }
 
-    private static UUID parseUUID(ByteBuffer buffer) {
+    private static UUID parseUUID(Buffer buffer) {
         long msb = buffer.getLong();
         long lsb = buffer.getLong();
         return new UUID(msb, lsb);
     }
 
-    private static Set<String> parseEntries(ByteBuffer buffer) {
+    private static Set<String> parseEntries(Buffer buffer) {
         return parseEntries(buffer.getInt(), buffer);
     }
 
-    private static Set<String> parseEntries(int count, ByteBuffer buffer) {
+    private static Set<String> parseEntries(int count, Buffer buffer) {
         Set<String> entries = new HashSet<>(count);
         for (int i = 0; i < count; i++) {
             entries.add(parseString(buffer));
@@ -139,11 +139,11 @@ class BinaryReferencesIndexLoaderV2 {
         return entries;
     }
 
-    private static String parseString(ByteBuffer buffer) {
+    private static String parseString(Buffer buffer) {
         return parseString(buffer.getInt(), buffer);
     }
 
-    private static String parseString(int length, ByteBuffer buffer) {
+    private static String parseString(int length, Buffer buffer) {
         byte[] data = new byte[length];
         buffer.get(data);
         return new String(data, Charsets.UTF_8);

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriter.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriter.java
 Wed Dec  5 17:00:25 2018
@@ -17,7 +17,6 @@
 
 package org.apache.jackrabbit.oak.segment.file.tar.binaries;
 
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -27,6 +26,7 @@ import java.util.UUID;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 
 /**
  * Maintains the transient state of a binary references index, formats it and
@@ -129,7 +129,7 @@ public class BinaryReferencesIndexWriter
             }
         }
 
-        ByteBuffer buffer = ByteBuffer.allocate(binaryReferenceSize);
+        Buffer buffer = Buffer.allocate(binaryReferenceSize);
 
         for (Entry<Generation, Map<UUID, Set<String>>> be : 
entries.entrySet()) {
             Generation generation = be.getKey();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV1.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV1.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV1.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV1.java
 Wed Dec  5 17:00:25 2018
@@ -17,17 +17,17 @@
 
 package org.apache.jackrabbit.oak.segment.file.tar.index;
 
-import java.nio.ByteBuffer;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 
 class IndexEntryV1 implements IndexEntry {
 
     static final int SIZE = 28;
 
-    private final ByteBuffer index;
+    private final Buffer index;
 
     private final int position;
 
-    IndexEntryV1(ByteBuffer index, int position) {
+    IndexEntryV1(Buffer index, int position) {
         this.index = index;
         this.position = position;
     }

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV2.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV2.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV2.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexEntryV2.java
 Wed Dec  5 17:00:25 2018
@@ -17,17 +17,17 @@
 
 package org.apache.jackrabbit.oak.segment.file.tar.index;
 
-import java.nio.ByteBuffer;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 
 class IndexEntryV2 implements IndexEntry {
 
     static final int SIZE = 33;
 
-    private final ByteBuffer index;
+    private final Buffer index;
 
     private final int position;
 
-    IndexEntryV2(ByteBuffer index, int position) {
+    IndexEntryV2(Buffer index, int position) {
         this.index = index;
         this.position = position;
     }

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1.java
 Wed Dec  5 17:00:25 2018
@@ -17,12 +17,12 @@
 
 package org.apache.jackrabbit.oak.segment.file.tar.index;
 
-import static java.nio.ByteBuffer.wrap;
+import static org.apache.jackrabbit.oak.segment.spi.persistence.Buffer.wrap;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
 
 class IndexLoaderV1 {
@@ -36,7 +36,7 @@ class IndexLoaderV1 {
     }
 
     IndexV1 loadIndex(ReaderAtEnd reader) throws InvalidIndexException, 
IOException {
-        ByteBuffer meta = reader.readAtEnd(IndexV1.FOOTER_SIZE, 
IndexV1.FOOTER_SIZE);
+        Buffer meta = reader.readAtEnd(IndexV1.FOOTER_SIZE, 
IndexV1.FOOTER_SIZE);
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -56,11 +56,11 @@ class IndexLoaderV1 {
             throw new InvalidIndexException("Invalid size alignment");
         }
 
-        ByteBuffer entries = reader.readAtEnd(IndexV1.FOOTER_SIZE + count * 
IndexEntryV1.SIZE, count * IndexEntryV1.SIZE);
+        Buffer entries = reader.readAtEnd(IndexV1.FOOTER_SIZE + count * 
IndexEntryV1.SIZE, count * IndexEntryV1.SIZE);
 
         CRC32 checksum = new CRC32();
         entries.mark();
-        checksum.update(entries);
+        entries.update(checksum);
         entries.reset();
         if (crc32 != (int) checksum.getValue()) {
             throw new InvalidIndexException("Invalid checksum");
@@ -73,7 +73,7 @@ class IndexLoaderV1 {
         for (int i = 0; i < count; i++) {
             entries.get(entry);
 
-            ByteBuffer buffer = wrap(entry);
+            Buffer buffer = wrap(entry);
             long msb = buffer.getLong();
             long lsb = buffer.getLong();
             int offset = buffer.getInt();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV2.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV2.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV2.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV2.java
 Wed Dec  5 17:00:25 2018
@@ -17,12 +17,12 @@
 
 package org.apache.jackrabbit.oak.segment.file.tar.index;
 
-import static java.nio.ByteBuffer.wrap;
+import static org.apache.jackrabbit.oak.segment.spi.persistence.Buffer.wrap;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
 
 class IndexLoaderV2 {
@@ -36,7 +36,7 @@ class IndexLoaderV2 {
     }
 
     IndexV2 loadIndex(ReaderAtEnd reader) throws InvalidIndexException, 
IOException {
-        ByteBuffer meta = reader.readAtEnd(IndexV2.FOOTER_SIZE, 
IndexV2.FOOTER_SIZE);
+        Buffer meta = reader.readAtEnd(IndexV2.FOOTER_SIZE, 
IndexV2.FOOTER_SIZE);
 
         int crc32 = meta.getInt();
         int count = meta.getInt();
@@ -56,11 +56,11 @@ class IndexLoaderV2 {
             throw new InvalidIndexException("Invalid size alignment");
         }
 
-        ByteBuffer entries = reader.readAtEnd(IndexV2.FOOTER_SIZE + count * 
IndexEntryV2.SIZE, count * IndexEntryV2.SIZE);
+        Buffer entries = reader.readAtEnd(IndexV2.FOOTER_SIZE + count * 
IndexEntryV2.SIZE, count * IndexEntryV2.SIZE);
 
         CRC32 checksum = new CRC32();
         entries.mark();
-        checksum.update(entries);
+        entries.update(checksum);
         entries.reset();
         if (crc32 != (int) checksum.getValue()) {
             throw new InvalidIndexException("Invalid checksum");
@@ -73,7 +73,7 @@ class IndexLoaderV2 {
         for (int i = 0; i < count; i++) {
             entries.get(entry);
 
-            ByteBuffer buffer = wrap(entry);
+            Buffer buffer = wrap(entry);
             long msb = buffer.getLong();
             long lsb = buffer.getLong();
             int offset = buffer.getInt();

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV1.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV1.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV1.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV1.java
 Wed Dec  5 17:00:25 2018
@@ -20,17 +20,18 @@ package org.apache.jackrabbit.oak.segmen
 import static com.google.common.base.Preconditions.checkElementIndex;
 import static com.google.common.collect.Sets.newHashSetWithExpectedSize;
 
-import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
+
 class IndexV1 implements Index {
 
     static final int FOOTER_SIZE = 16;
 
-    private final ByteBuffer entries;
+    private final Buffer entries;
 
-    IndexV1(ByteBuffer entries) {
+    IndexV1(Buffer entries) {
         this.entries = entries;
     }
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV2.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV2.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV2.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexV2.java
 Wed Dec  5 17:00:25 2018
@@ -20,17 +20,18 @@ package org.apache.jackrabbit.oak.segmen
 import static com.google.common.base.Preconditions.checkElementIndex;
 import static com.google.common.collect.Sets.newHashSetWithExpectedSize;
 
-import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
+
 class IndexV2 implements Index {
 
     static final int FOOTER_SIZE = 16;
 
-    private final ByteBuffer entries;
+    private final Buffer entries;
 
-    IndexV2(ByteBuffer entries) {
+    IndexV2(Buffer entries) {
         this.entries = entries;
     }
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexWriter.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexWriter.java
 Wed Dec  5 17:00:25 2018
@@ -19,11 +19,12 @@ package org.apache.jackrabbit.oak.segmen
 
 import static com.google.common.base.Preconditions.checkArgument;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.zip.CRC32;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
+
 /**
  * Builds an index incrementally in memory, and serializes its contents into a
  * sequence of bytes.
@@ -106,7 +107,7 @@ public class IndexWriter {
         int dataSize = entries.size() * IndexEntryV2.SIZE + 
IndexV2.FOOTER_SIZE;
         int totalSize = ((dataSize + blockSize - 1) / blockSize) * blockSize;
 
-        ByteBuffer buffer = ByteBuffer.allocate(totalSize);
+        Buffer buffer = Buffer.allocate(totalSize);
         buffer.position(totalSize - dataSize);
 
         entries.sort((a, b) -> {

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/memory/MemoryStore.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/memory/MemoryStore.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/memory/MemoryStore.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/memory/MemoryStore.java
 Wed Dec  5 17:00:25 2018
@@ -21,7 +21,6 @@ package org.apache.jackrabbit.oak.segmen
 import static 
org.apache.jackrabbit.oak.segment.DefaultSegmentWriterBuilder.defaultSegmentWriterBuilder;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
@@ -37,6 +36,7 @@ import org.apache.jackrabbit.oak.segment
 import org.apache.jackrabbit.oak.segment.SegmentStore;
 import org.apache.jackrabbit.oak.segment.SegmentTracker;
 import org.apache.jackrabbit.oak.segment.SegmentWriter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.stats.NoopStats;
 import org.jetbrains.annotations.NotNull;
@@ -113,7 +113,7 @@ public class MemoryStore implements Segm
     @Override
     public void writeSegment(
             SegmentId id, byte[] data, int offset, int length) throws 
IOException {
-        ByteBuffer buffer = ByteBuffer.allocate(length);
+        Buffer buffer = Buffer.allocate(length);
         buffer.put(data, offset, length);
         buffer.rewind();
         Segment segment = new Segment(tracker, segmentReader, id, buffer);

Added: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/Buffer.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/Buffer.java?rev=1848226&view=auto
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/Buffer.java
 (added)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/Buffer.java
 Wed Dec  5 17:00:25 2018
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.channels.WritableByteChannel;
+import java.nio.charset.Charset;
+import java.util.zip.CRC32;
+
+/**
+ * This is a wrapper around {@link ByteBuffer}. It maintains the same semantics
+ * and mechanisms of the {@link ByteBuffer}.
+ * <p>
+ * Java 9 introduced API changes to some methods in {@link ByteBuffer}. Instead
+ * of returning instances of {@link java.nio.Buffer Buffer}, those methods were
+ * rewritten to return instances of {@link ByteBuffer} instead. While this is
+ * perfectly fine at compile time, running "modern" code on Java 8 and earlier
+ * throws {@link NoSuchMethodError}. In order to prevent occurrences of this
+ * exceptions in the future, {@link Buffer} is used consistently in place of
+ * {@link ByteBuffer}. Since it is not possible to directly convert a {@link
+ * Buffer} into a {@link ByteBuffer} and the other way around, {@link Buffer}
+ * makes it less likely to develop dangerous code in the future.
+ */
+final public class Buffer {
+
+    private final ByteBuffer buffer;
+
+    private Buffer(ByteBuffer buffer) {
+        this.buffer = buffer;
+    }
+
+    public static Buffer map(FileChannel channel, MapMode mode, long position, 
long size) throws IOException {
+        return new Buffer(channel.map(mode, position, size));
+    }
+
+    public static Buffer wrap(byte[] buffer) {
+        return new Buffer(ByteBuffer.wrap(buffer));
+    }
+
+    public static Buffer wrap(byte[] buffer, int pos, int len) {
+        return new Buffer(ByteBuffer.wrap(buffer, pos, len));
+    }
+
+    public static Buffer allocate(int cap) {
+        return new Buffer(ByteBuffer.allocate(cap));
+    }
+
+    public static Buffer allocateDirect(int cap) {
+        return new Buffer(ByteBuffer.allocateDirect(cap));
+    }
+
+    public int remaining() {
+        return buffer.remaining();
+    }
+
+    public Buffer asReadOnlyBuffer() {
+        return new Buffer(buffer.asReadOnlyBuffer());
+    }
+
+    public Buffer position(int pos) {
+        ((java.nio.Buffer) buffer).position(pos);
+        return this;
+    }
+
+    public int position() {
+        return buffer.position();
+    }
+
+    public Buffer limit(int lim) {
+        ((java.nio.Buffer) buffer).limit(lim);
+        return this;
+    }
+
+    public int limit() {
+        return buffer.limit();
+    }
+
+    public Buffer slice() {
+        return new Buffer(buffer.slice());
+    }
+
+    public int readFully(FileChannel channel, int position) throws IOException 
{
+        int result = 0;
+        while (buffer.remaining() > 0) {
+            int count = channel.read(buffer, position);
+            if (count < 0) {
+                break;
+            }
+            result += count;
+            position += count;
+        }
+        return result;
+    }
+
+    public Buffer flip() {
+        ((java.nio.Buffer) buffer).flip();
+        return this;
+    }
+
+    public int getInt() {
+        return buffer.getInt();
+    }
+
+    public int getInt(int pos) {
+        return buffer.getInt(pos);
+    }
+
+    public Buffer mark() {
+        ((java.nio.Buffer) buffer).mark();
+        return this;
+    }
+
+    public Buffer get(byte[] b) {
+        buffer.get(b);
+        return this;
+    }
+
+    public Buffer get(byte[] b, int pos, int len) {
+        buffer.get(b, pos, len);
+        return this;
+    }
+
+    public byte get(int pos) {
+        return buffer.get(pos);
+    }
+
+    public byte get() {
+        return buffer.get();
+    }
+
+    public Buffer reset() {
+        ((java.nio.Buffer) buffer).reset();
+        return this;
+    }
+
+    public void update(CRC32 checksum) {
+        checksum.update(buffer);
+    }
+
+    public byte[] array() {
+        return buffer.array();
+    }
+
+    public int capacity() {
+        return buffer.capacity();
+    }
+
+    public boolean isDirect() {
+        return buffer.isDirect();
+    }
+
+    public Buffer put(byte[] b) {
+        buffer.put(b);
+        return this;
+    }
+
+    public Buffer put(byte[] buf, int pos, int len) {
+        buffer.put(buf, pos, len);
+        return this;
+    }
+
+    public Buffer put(byte b) {
+        buffer.put(b);
+        return this;
+    }
+
+    public Buffer put(Buffer b) {
+        buffer.put(b.buffer);
+        return this;
+    }
+
+    public Buffer rewind() {
+        ((java.nio.Buffer) buffer).rewind();
+        return this;
+    }
+
+    public long getLong(int pos) {
+        return buffer.getLong(pos);
+    }
+
+    public long getLong() {
+        return buffer.getLong();
+    }
+
+    public short getShort(int pos) {
+        return buffer.getShort(pos);
+    }
+
+    public Buffer duplicate() {
+        return new Buffer(buffer.duplicate());
+    }
+
+    public CharBuffer decode(Charset charset) {
+        return charset.decode(buffer);
+    }
+
+    public boolean hasRemaining() {
+        return buffer.hasRemaining();
+    }
+
+    public int write(WritableByteChannel channel) throws IOException {
+        return channel.write(buffer);
+    }
+
+    public Buffer putInt(int i) {
+        buffer.putInt(i);
+        return this;
+    }
+
+    public Buffer putLong(long l) {
+        buffer.putLong(l);
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        return buffer.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof Buffer) {
+            return buffer.equals(((Buffer) obj).buffer);
+        }
+        return false;
+    }
+
+}

Propchange: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/Buffer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java
 Wed Dec  5 17:00:25 2018
@@ -20,7 +20,6 @@ package org.apache.jackrabbit.oak.segmen
 
 import java.io.Closeable;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.List;
 
 import org.jetbrains.annotations.NotNull;
@@ -40,7 +39,7 @@ public interface SegmentArchiveReader ex
      * @return byte buffer containing the segment data or null if the segment 
doesn't exist
      */
     @Nullable
-    ByteBuffer readSegment(long msb, long lsb) throws IOException;
+    Buffer readSegment(long msb, long lsb) throws IOException;
 
     /**
      * Check if the segment exists.
@@ -65,7 +64,7 @@ public interface SegmentArchiveReader ex
      * persisted.
      */
     @Nullable
-    ByteBuffer getGraph() throws IOException;
+    Buffer getGraph() throws IOException;
 
     /**
      * Check if the segment graph has been persisted for this archive.
@@ -80,7 +79,7 @@ public interface SegmentArchiveReader ex
      * @return byte buffer representing the binary references structure.
      */
     @NotNull
-    ByteBuffer getBinaryReferences() throws IOException;
+    Buffer getBinaryReferences() throws IOException;
 
     /**
      * Get the current length of the archive.

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java
 Wed Dec  5 17:00:25 2018
@@ -19,7 +19,6 @@
 package org.apache.jackrabbit.oak.segment.spi.persistence;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -75,7 +74,7 @@ public interface SegmentArchiveWriter {
      * @return byte buffer containing the segment data or null if segment 
doesn't exist
      */
     @Nullable
-    ByteBuffer readSegment(long msb, long lsb) throws IOException;
+    Buffer readSegment(long msb, long lsb) throws IOException;
 
     /**
      * Check if the segment exists.

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/split/UnclosedSegmentArchiveReader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/split/UnclosedSegmentArchiveReader.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/split/UnclosedSegmentArchiveReader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/split/UnclosedSegmentArchiveReader.java
 Wed Dec  5 17:00:25 2018
@@ -16,28 +16,28 @@
  */
 package org.apache.jackrabbit.oak.segment.split;
 
+import java.io.IOException;
+import java.util.List;
+
 import 
org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexWriter;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveEntry;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveReader;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.List;
-
 class UnclosedSegmentArchiveReader implements SegmentArchiveReader {
 
     private final SegmentArchiveReader delegate;
 
-    private static final ByteBuffer EMPTY_BINARY_REF = 
ByteBuffer.wrap(BinaryReferencesIndexWriter.newBinaryReferencesIndexWriter().write()).asReadOnlyBuffer();
+    private static final Buffer EMPTY_BINARY_REF = 
Buffer.wrap(BinaryReferencesIndexWriter.newBinaryReferencesIndexWriter().write()).asReadOnlyBuffer();
 
     UnclosedSegmentArchiveReader(SegmentArchiveReader delegate) {
         this.delegate = delegate;
     }
 
     @Override
-    public @Nullable ByteBuffer readSegment(long msb, long lsb) throws 
IOException {
+    public @Nullable Buffer readSegment(long msb, long lsb) throws IOException 
{
         return delegate.readSegment(msb, lsb);
     }
 
@@ -52,7 +52,7 @@ class UnclosedSegmentArchiveReader imple
     }
 
     @Override
-    public @Nullable ByteBuffer getGraph() throws IOException {
+    public @Nullable Buffer getGraph() throws IOException {
         return delegate.getGraph();
     }
 
@@ -62,8 +62,8 @@ class UnclosedSegmentArchiveReader imple
     }
 
     @Override
-    public @NotNull ByteBuffer getBinaryReferences() throws IOException {
-        ByteBuffer buffer = delegate.getBinaryReferences();
+    public @NotNull Buffer getBinaryReferences() throws IOException {
+        Buffer buffer = delegate.getBinaryReferences();
         if (buffer == null) {
             return EMPTY_BINARY_REF;
         } else {

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/CharsetEncodingUtils.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/CharsetEncodingUtils.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/CharsetEncodingUtils.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/CharsetEncodingUtils.java
 Wed Dec  5 17:00:25 2018
@@ -21,7 +21,6 @@ import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CodingErrorAction;
-
 import java.nio.charset.StandardCharsets;
 
 /**

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/ReaderAtEnd.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/ReaderAtEnd.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/ReaderAtEnd.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/util/ReaderAtEnd.java
 Wed Dec  5 17:00:25 2018
@@ -18,7 +18,8 @@
 package org.apache.jackrabbit.oak.segment.util;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
+
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 
 /**
  * Read raw data from the end of an underlying data source. The data source is
@@ -34,10 +35,10 @@ public interface ReaderAtEnd {
      *
      * @param whence The offset from the end of the data source.
      * @param amount The amount of data to read, in bytes.
-     * @return An instance of {@link ByteBuffer}.
+     * @return An instance of {@link Buffer}.
      * @throws IOException if an error occurs while reading from the underlying
      *                     data source.
      */
-    ByteBuffer readAtEnd(int whence, int amount) throws IOException;
+    Buffer readAtEnd(int whence, int amount) throws IOException;
 
 }

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CacheWeightEstimator.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CacheWeightEstimator.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CacheWeightEstimator.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CacheWeightEstimator.java
 Wed Dec  5 17:00:25 2018
@@ -25,7 +25,6 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assume.assumeTrue;
 
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Map.Entry;
 import java.util.UUID;
@@ -37,6 +36,7 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.segment.CacheWeights.StringCacheWeigher;
 import org.apache.jackrabbit.oak.segment.file.PriorityCache;
 import org.apache.jackrabbit.oak.segment.memory.MemoryStore;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -337,7 +337,7 @@ public class CacheWeightEstimator {
         buffer[GC_FULL_GENERATION_OFFSET + 2] = (byte) (generation >> 8);
         buffer[GC_FULL_GENERATION_OFFSET + 3] = (byte) generation;
 
-        ByteBuffer data = ByteBuffer.wrap(buffer);
+        Buffer data = Buffer.wrap(buffer);
         SegmentId id = randomSegmentId(false);
         Segment segment = new Segment(store.getSegmentIdProvider(), 
store.getReader(), id, data);
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactorTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactorTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/CompactorTest.java
 Wed Dec  5 17:00:25 2018
@@ -32,7 +32,6 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.Random;
 
@@ -42,6 +41,7 @@ import org.apache.jackrabbit.oak.segment
 import org.apache.jackrabbit.oak.segment.file.GCNodeWriteMonitor;
 import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
 import org.apache.jackrabbit.oak.segment.file.cancel.Canceller;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -178,6 +178,7 @@ public class CompactorTest {
     }
 
     private static class FailingSegmentWriter implements SegmentWriter {
+
         @NotNull
         private final SegmentWriter delegate;
 
@@ -208,13 +209,12 @@ public class CompactorTest {
 
         @NotNull
         @Override
-        public RecordId writeNode(@NotNull NodeState state, @Nullable 
ByteBuffer stableIdBytes)
-        throws IOException {
+        public RecordId writeNode(@NotNull NodeState state, @Nullable Buffer 
stableIdBytes) throws IOException {
             if (state.hasChildNode(failOnName)) {
                 throw new IOException("Encountered node with name " + 
failOnName);
             }
-
             return delegate.writeNode(state, stableIdBytes);
         }
+
     }
 }

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/NodeRecordTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/NodeRecordTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/NodeRecordTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/NodeRecordTest.java
 Wed Dec  5 17:00:25 2018
@@ -24,13 +24,12 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.nio.ByteBuffer;
-
 import com.google.common.base.Supplier;
 import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
 import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
 import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.jetbrains.annotations.NotNull;
 import org.junit.Rule;
 import org.junit.Test;
@@ -88,7 +87,7 @@ public class NodeRecordTest {
         }
     }
 
-    private static final byte[] asByteArray(ByteBuffer bytes) {
+    private static final byte[] asByteArray(Buffer bytes) {
         byte[] buffer = new byte[RecordId.SERIALIZED_RECORD_ID_BYTES];
         bytes.get(buffer);
         return buffer;

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBufferMonitorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBufferMonitorTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBufferMonitorTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBufferMonitorTest.java
 Wed Dec  5 17:00:25 2018
@@ -27,11 +27,11 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.nio.ByteBuffer;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.jackrabbit.api.stats.RepositoryStatistics;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.stats.CounterStats;
 import org.apache.jackrabbit.oak.stats.HistogramStats;
 import org.apache.jackrabbit.oak.stats.MeterStats;
@@ -84,7 +84,7 @@ public class SegmentBufferMonitorTest {
 
     @Test
     public void heapBuffer() {
-        ByteBuffer buffer = ByteBuffer.allocate(42);
+        Buffer buffer = Buffer.allocate(42);
         segmentBufferMonitor.trackAllocation(buffer);
 
         assertEquals(0, stats.get(DIRECT_BUFFER_COUNT).getCount());
@@ -103,7 +103,7 @@ public class SegmentBufferMonitorTest {
 
     @Test
     public void directBuffer() {
-        ByteBuffer buffer = ByteBuffer.allocateDirect(42);
+        Buffer buffer = Buffer.allocateDirect(42);
         segmentBufferMonitor.trackAllocation(buffer);
 
         assertEquals(1, stats.get(DIRECT_BUFFER_COUNT).getCount());

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java
 Wed Dec  5 17:00:25 2018
@@ -28,7 +28,6 @@ import static org.mockito.internal.util.
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -38,6 +37,7 @@ import java.util.UUID;
 
 import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitorAdapter;
 import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveEntry;
 import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
 import org.junit.Before;
@@ -74,12 +74,12 @@ public class TarFileTest {
 
         try (TarWriter writer = new TarWriter(archiveManager, 
"data00000a.tar")) {
             writer.writeEntry(msb, lsb, data, 0, data.length, generation(0));
-            assertEquals(ByteBuffer.wrap(data), writer.readEntry(msb, lsb));
+            assertEquals(Buffer.wrap(data), writer.readEntry(msb, lsb));
         }
 
         try (TarReader reader = TarReader.open("data00000a.tar", 
archiveManager)) {
             assertEquals(getWriteAndReadExpectedSize(), reader.size());
-            assertEquals(ByteBuffer.wrap(data), reader.readEntry(msb, lsb));
+            assertEquals(Buffer.wrap(data), reader.readEntry(msb, lsb));
         }
     }
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java
 Wed Dec  5 17:00:25 2018
@@ -32,7 +32,6 @@ import static org.junit.Assert.assertTru
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -44,6 +43,7 @@ import java.util.UUID;
 import org.apache.jackrabbit.oak.segment.file.tar.TarFiles.CleanupResult;
 import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitorAdapter;
 import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -121,7 +121,7 @@ public class TarFilesTest {
     }
 
     private byte[] readSegment(UUID id) {
-        ByteBuffer buffer = tarFiles.readSegment(id.getMostSignificantBits(), 
id.getLeastSignificantBits());
+        Buffer buffer = tarFiles.readSegment(id.getMostSignificantBits(), 
id.getLeastSignificantBits());
         if (buffer == null) {
             return null;
         }

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java
 Wed Dec  5 17:00:25 2018
@@ -20,7 +20,6 @@ package org.apache.jackrabbit.oak.segmen
 import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -29,6 +28,7 @@ import java.util.UUID;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class BinaryReferencesIndexLoaderTest {
@@ -41,17 +41,17 @@ public class BinaryReferencesIndexLoader
         return s.getBytes(Charsets.UTF_8);
     }
 
-    private static int checksum(ByteBuffer buffer) {
+    private static int checksum(Buffer buffer) {
         CRC32 checksum = new CRC32();
         int position = buffer.position();
-        checksum.update(buffer);
+        buffer.update(checksum);
         buffer.position(position);
         return (int) checksum.getValue();
     }
 
-    private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws 
Exception {
-        ByteBuffer data = 
BinaryReferencesIndexLoader.loadBinaryReferencesIndex((whence, length) -> {
-            ByteBuffer slice = buffer.duplicate();
+    private static BinaryReferencesIndex loadIndex(Buffer buffer) throws 
Exception {
+        Buffer data = 
BinaryReferencesIndexLoader.loadBinaryReferencesIndex((whence, length) -> {
+            Buffer slice = buffer.duplicate();
             slice.position(slice.limit() - whence);
             slice.limit(slice.position() + length);
             return slice.slice();
@@ -61,7 +61,7 @@ public class BinaryReferencesIndexLoader
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testUnrecognizedMagicNumber() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
+        Buffer buffer = Buffer.allocate(Integer.BYTES);
         try {
             loadIndex(buffer);
         } catch (InvalidBinaryReferencesIndexException e) {
@@ -72,7 +72,7 @@ public class BinaryReferencesIndexLoader
 
     @Test
     public void testLoadV1() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1)
             .putInt(2)
@@ -101,7 +101,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
BinaryReferencesIndexLoaderV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + 
BinaryReferencesIndexLoaderV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -144,7 +144,7 @@ public class BinaryReferencesIndexLoader
 
     @Test
     public void testLoadV2() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1).putInt(2).put((byte) 0)
             .putInt(2)
@@ -173,7 +173,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
BinaryReferencesIndexLoaderV2.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + 
BinaryReferencesIndexLoaderV2.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java
 Wed Dec  5 17:00:25 2018
@@ -24,10 +24,10 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class BinaryReferencesIndexLoaderV1Test {
@@ -40,9 +40,9 @@ public class BinaryReferencesIndexLoader
         return s.getBytes(Charsets.UTF_8);
     }
 
-    private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws 
Exception {
-        ByteBuffer data = loadBinaryReferencesIndex((whence, length) -> {
-            ByteBuffer slice = buffer.duplicate();
+    private static BinaryReferencesIndex loadIndex(Buffer buffer) throws 
Exception {
+        Buffer data = loadBinaryReferencesIndex((whence, length) -> {
+            Buffer slice = buffer.duplicate();
             slice.position(slice.limit() - whence);
             slice.limit(slice.position() + length);
             return slice.slice();
@@ -50,7 +50,7 @@ public class BinaryReferencesIndexLoader
         return parseBinaryReferencesIndex(data);
     }
 
-    private static void assertInvalidBinaryReferencesIndexException(ByteBuffer 
buffer, String message) throws Exception {
+    private static void assertInvalidBinaryReferencesIndexException(Buffer 
buffer, String message) throws Exception {
         try {
             loadIndex(buffer);
         } catch (InvalidBinaryReferencesIndexException e) {
@@ -59,23 +59,23 @@ public class BinaryReferencesIndexLoader
         }
     }
 
-    private static int checksum(ByteBuffer buffer) {
+    private static int checksum(Buffer buffer) {
         CRC32 checksum = new CRC32();
         int position = buffer.position();
-        checksum.update(buffer);
+        buffer.update(checksum);
         buffer.position(position);
         return (int) checksum.getValue();
     }
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidMagicNumber() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         assertInvalidBinaryReferencesIndexException(buffer, "Invalid magic 
number");
     }
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidCount() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(-1)
@@ -86,7 +86,7 @@ public class BinaryReferencesIndexLoader
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidSize() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(0)
@@ -97,7 +97,7 @@ public class BinaryReferencesIndexLoader
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidChecksum() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1)
             .putInt(2)
@@ -126,7 +126,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries) + 1)
@@ -139,7 +139,7 @@ public class BinaryReferencesIndexLoader
 
     @Test
     public void testParse() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1)
             .putInt(2)
@@ -168,7 +168,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java
 Wed Dec  5 17:00:25 2018
@@ -24,10 +24,10 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
 import com.google.common.base.Charsets;
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class BinaryReferencesIndexLoaderV2Test {
@@ -40,9 +40,9 @@ public class BinaryReferencesIndexLoader
         return s.getBytes(Charsets.UTF_8);
     }
 
-    private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws 
Exception {
-        ByteBuffer data = loadBinaryReferencesIndex((whence, length) -> {
-            ByteBuffer slice = buffer.duplicate();
+    private static BinaryReferencesIndex loadIndex(Buffer buffer) throws 
Exception {
+        Buffer data = loadBinaryReferencesIndex((whence, length) -> {
+            Buffer slice = buffer.duplicate();
             slice.position(slice.limit() - whence);
             slice.limit(slice.position() + length);
             return slice.slice();
@@ -50,7 +50,7 @@ public class BinaryReferencesIndexLoader
         return parseBinaryReferencesIndex(data);
     }
 
-    private static void assertInvalidBinaryReferencesIndexException(ByteBuffer 
buffer, String message) throws Exception {
+    private static void assertInvalidBinaryReferencesIndexException(Buffer 
buffer, String message) throws Exception {
         try {
             loadIndex(buffer);
         } catch (InvalidBinaryReferencesIndexException e) {
@@ -59,23 +59,23 @@ public class BinaryReferencesIndexLoader
         }
     }
 
-    private static int checksum(ByteBuffer buffer) {
+    private static int checksum(Buffer buffer) {
         CRC32 checksum = new CRC32();
         int position = buffer.position();
-        checksum.update(buffer);
+        buffer.update(checksum);
         buffer.position(position);
         return (int) checksum.getValue();
     }
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidMagicNumber() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         assertInvalidBinaryReferencesIndexException(buffer, "Invalid magic 
number");
     }
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidCount() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(-1)
@@ -86,7 +86,7 @@ public class BinaryReferencesIndexLoader
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidSize() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(0)
@@ -97,7 +97,7 @@ public class BinaryReferencesIndexLoader
 
     @Test(expected = InvalidBinaryReferencesIndexException.class)
     public void testInvalidChecksum() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1).putInt(2).put((byte) 0)
             .putInt(2)
@@ -126,7 +126,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries) + 1)
@@ -139,7 +139,7 @@ public class BinaryReferencesIndexLoader
 
     @Test
     public void testParse() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(512)
+        Buffer entries = Buffer.allocate(512)
             // First generation
             .putInt(1).putInt(2).put((byte) 0)
             .putInt(2)
@@ -168,7 +168,7 @@ public class BinaryReferencesIndexLoader
             .putInt(length("2.2.2")).put(bytes("2.2.2"));
         entries.flip();
 
-        ByteBuffer buffer = ByteBuffer.allocate(entries.remaining() + 
FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(entries.remaining() + FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java
 Wed Dec  5 17:00:25 2018
@@ -23,13 +23,13 @@ import static org.apache.jackrabbit.oak.
 import static 
org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexWriter.newBinaryReferencesIndexWriter;
 import static org.junit.Assert.assertEquals;
 
-import java.nio.ByteBuffer;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class BinaryReferencesIndexWriterTest {
@@ -53,7 +53,7 @@ public class BinaryReferencesIndexWriter
 
         byte[] data = writer.write();
 
-        ByteBuffer buffer = loadBinaryReferencesIndex((whence, length) -> 
ByteBuffer.wrap(data, data.length - whence, length));
+        Buffer buffer = loadBinaryReferencesIndex((whence, length) -> 
Buffer.wrap(data, data.length - whence, length));
         BinaryReferencesIndex index = parseBinaryReferencesIndex(buffer);
 
         Generation g1 = new Generation(1, 2, false);

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderTest.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderTest.java
 Wed Dec  5 17:00:25 2018
@@ -21,15 +21,14 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.nio.ByteBuffer;
-
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class IndexLoaderTest {
 
-    private static Index loadIndex(ByteBuffer buffer) throws Exception {
+    private static Index loadIndex(Buffer buffer) throws Exception {
         return newIndexLoader(1).loadIndex((whence, length) -> {
-            ByteBuffer slice = buffer.duplicate();
+            Buffer slice = buffer.duplicate();
             slice.position(slice.limit() - whence);
             slice.limit(slice.position() + length);
             return slice.slice();
@@ -48,7 +47,7 @@ public class IndexLoaderTest {
 
     @Test(expected = InvalidIndexException.class)
     public void testUnrecognizedMagicNumber() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(Integer.SIZE);
+        Buffer buffer = Buffer.allocate(Integer.SIZE);
         buffer.duplicate().putInt(0xDEADBEEF);
         try {
             loadIndex(buffer);
@@ -60,7 +59,7 @@ public class IndexLoaderTest {
 
     @Test
     public void testLoadIndexV1() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
                 .putLong(1).putLong(2).putInt(3).putInt(4).putInt(5)
                 .putLong(6).putLong(7).putInt(8).putInt(9).putInt(10)
@@ -77,7 +76,7 @@ public class IndexLoaderTest {
 
     @Test
     public void testLoadIndexV2() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV2.SIZE + 
IndexV2.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV2.SIZE + 
IndexV2.FOOTER_SIZE);
         buffer.duplicate()
                 
.putLong(1).putLong(2).putInt(3).putInt(4).putInt(5).putInt(6).put((byte) 0)
                 
.putLong(7).putLong(8).putInt(9).putInt(10).putInt(11).putInt(12).put((byte) 1)

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1Test.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1Test.java?rev=1848226&r1=1848225&r2=1848226&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1Test.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/index/IndexLoaderV1Test.java
 Wed Dec  5 17:00:25 2018
@@ -20,27 +20,27 @@ package org.apache.jackrabbit.oak.segmen
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
+import org.apache.jackrabbit.oak.segment.spi.persistence.Buffer;
 import org.junit.Test;
 
 public class IndexLoaderV1Test {
 
-    private static IndexV1 loadIndex(ByteBuffer buffer) throws Exception {
+    private static IndexV1 loadIndex(Buffer buffer) throws Exception {
         return loadIndex(1, buffer);
     }
 
-    private static IndexV1 loadIndex(int blockSize, ByteBuffer buffer) throws 
Exception {
+    private static IndexV1 loadIndex(int blockSize, Buffer buffer) throws 
Exception {
         return new IndexLoaderV1(blockSize).loadIndex((whence, length) -> {
-            ByteBuffer slice = buffer.duplicate();
+            Buffer slice = buffer.duplicate();
             slice.position(slice.limit() - whence);
             slice.limit(slice.position() + length);
             return slice.slice();
         });
     }
 
-    private static void assertInvalidIndexException(ByteBuffer buffer, String 
message) throws Exception {
+    private static void assertInvalidIndexException(Buffer buffer, String 
message) throws Exception {
         try {
             loadIndex(buffer);
         } catch (InvalidIndexException e) {
@@ -49,7 +49,7 @@ public class IndexLoaderV1Test {
         }
     }
 
-    private static void assertInvalidIndexException(int blockSize, ByteBuffer 
buffer, String message) throws Exception {
+    private static void assertInvalidIndexException(int blockSize, Buffer 
buffer, String message) throws Exception {
         try {
             loadIndex(blockSize, buffer);
         } catch (InvalidIndexException e) {
@@ -58,17 +58,17 @@ public class IndexLoaderV1Test {
         }
     }
 
-    private static int checksum(ByteBuffer buffer) {
+    private static int checksum(Buffer buffer) {
         CRC32 checksum = new CRC32();
         int position = buffer.position();
-        checksum.update(buffer);
+        buffer.update(checksum);
         buffer.position(position);
         return (int) checksum.getValue();
     }
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidMagic() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexV1.FOOTER_SIZE);
         try {
             loadIndex(buffer);
         } catch (InvalidIndexException e) {
@@ -79,7 +79,7 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidCount() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(0)
@@ -90,7 +90,7 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidSize() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(1)
@@ -101,7 +101,7 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidSizeAlignment() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .putInt(0)
             .putInt(1)
@@ -112,7 +112,7 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidChecksum() throws Exception {
-        ByteBuffer buffer = ByteBuffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .putLong(1).putLong(2).putInt(3).putInt(4).putInt(5)
             .putInt(0)
@@ -124,12 +124,12 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testIncorrectEntryOrderingByMsb() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(2 * IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(2 * IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(1).putLong(0).putInt(0).putInt(1).putInt(0)
             .putLong(0).putLong(0).putInt(1).putInt(1).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -142,12 +142,12 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testIncorrectEntryOrderingByLsb() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(2 * IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(2 * IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(1).putInt(0).putInt(1).putInt(0)
             .putLong(0).putLong(0).putInt(1).putInt(1).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -160,12 +160,12 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testDuplicateEntry() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(2 * IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(2 * IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(0).putInt(0).putInt(1).putInt(0)
             .putLong(0).putLong(0).putInt(1).putInt(1).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -178,11 +178,11 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidEntryOffset() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(0).putInt(-1).putInt(1).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -195,11 +195,11 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidEntryOffsetAlignment() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(0).putInt(1).putInt(1).putInt(0);
 
-        ByteBuffer index = ByteBuffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer index = Buffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         index.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -207,7 +207,7 @@ public class IndexLoaderV1Test {
             .putInt(2 * (IndexEntryV1.SIZE + IndexV1.FOOTER_SIZE))
             .putInt(IndexLoaderV1.MAGIC);
 
-        ByteBuffer buffer = ByteBuffer.allocate(2 * (IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE));
+        Buffer buffer = Buffer.allocate(2 * (IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE));
         buffer.mark();
         buffer.position(buffer.limit() - IndexEntryV1.SIZE - 
IndexV1.FOOTER_SIZE);
         buffer.put(index);
@@ -218,11 +218,11 @@ public class IndexLoaderV1Test {
 
     @Test(expected = InvalidIndexException.class)
     public void testInvalidEntrySize() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(0).putInt(0).putInt(0).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))
@@ -235,12 +235,12 @@ public class IndexLoaderV1Test {
 
     @Test
     public void testLoadIndex() throws Exception {
-        ByteBuffer entries = ByteBuffer.allocate(2 * IndexEntryV1.SIZE);
+        Buffer entries = Buffer.allocate(2 * IndexEntryV1.SIZE);
         entries.duplicate()
             .putLong(0).putLong(0).putInt(0).putInt(1).putInt(0)
             .putLong(0).putLong(1).putInt(1).putInt(1).putInt(0);
 
-        ByteBuffer buffer = ByteBuffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
+        Buffer buffer = Buffer.allocate(2 * IndexEntryV1.SIZE + 
IndexV1.FOOTER_SIZE);
         buffer.duplicate()
             .put(entries.duplicate())
             .putInt(checksum(entries))


Reply via email to