public static CodedInputStream inputStreamFromByteRange(PositionedByteRange src) {
    return CodedInputStream.newInstance(src.getBytes(), src.getOffset() + src.getPosition(),
      src.getRemaining());
  }
Create a {@link CodedInputStream} from a {@link PositionedByteRange}. Be sure to update
{@code src}'s position after consuming from the stream.
<p/>
For example:

<pre>
Foo.Builder builder = ...
CodedInputStream is = inputStreamFromByteRange(src);
Foo ret = builder.mergeFrom(is).build();
src.setPosition(src.getPosition() + is.getTotalBytesRead());
</pre>
hbase-examples/src/main/java/org/apache/hadoop/hbase/types/PBType.java