Index: trunk/src/com/drew/lang/ByteArrayReader.java
===================================================================
--- trunk/src/com/drew/lang/ByteArrayReader.java	(revision 10862)
+++ trunk/src/com/drew/lang/ByteArrayReader.java	(revision 13061)
@@ -1,4 +1,4 @@
 /*
- * Copyright 2002-2016 Drew Noakes
+ * Copyright 2002-2017 Drew Noakes
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@
 package com.drew.lang;
 
+import com.drew.lang.annotations.NotNull;
+
 import java.io.IOException;
-
-import com.drew.lang.annotations.NotNull;
 
 /**
@@ -39,11 +39,30 @@
     @NotNull
     private final byte[] _buffer;
+    private final int _baseOffset;
 
+    @SuppressWarnings({ "ConstantConditions" })
+    @com.drew.lang.annotations.SuppressWarnings(value = "EI_EXPOSE_REP2", justification = "Design intent")
     public ByteArrayReader(@NotNull byte[] buffer)
+    {
+        this(buffer, 0);
+    }
+
+    @SuppressWarnings({ "ConstantConditions" })
+    @com.drew.lang.annotations.SuppressWarnings(value = "EI_EXPOSE_REP2", justification = "Design intent")
+    public ByteArrayReader(@NotNull byte[] buffer, int baseOffset)
     {
         if (buffer == null)
             throw new NullPointerException();
+        if (baseOffset < 0)
+            throw new IllegalArgumentException("Must be zero or greater");
 
         _buffer = buffer;
+        _baseOffset = baseOffset;
+    }
+
+    @Override
+    public int toUnshiftedOffset(int localOffset)
+    {
+        return localOffset + _baseOffset;
     }
 
@@ -51,11 +70,12 @@
     public long getLength()
     {
-        return _buffer.length;
+        return _buffer.length - _baseOffset;
     }
 
     @Override
-    protected byte getByte(int index) throws IOException
+    public byte getByte(int index) throws IOException
     {
-        return _buffer[index];
+        validateIndex(index, 1);
+        return _buffer[index + _baseOffset];
     }
 
@@ -64,5 +84,5 @@
     {
         if (!isValidIndex(index, bytesRequested))
-            throw new BufferBoundsException(index, bytesRequested, _buffer.length);
+            throw new BufferBoundsException(toUnshiftedOffset(index), bytesRequested, _buffer.length);
     }
 
@@ -72,5 +92,5 @@
         return bytesRequested >= 0
             && index >= 0
-            && (long)index + (long)bytesRequested - 1L < _buffer.length;
+            && (long)index + (long)bytesRequested - 1L < getLength();
     }
 
@@ -82,5 +102,5 @@
 
         byte[] bytes = new byte[count];
-        System.arraycopy(_buffer, index, bytes, 0, count);
+        System.arraycopy(_buffer, index + _baseOffset, bytes, 0, count);
         return bytes;
     }
