stop using ByteBuffer.mark()

This commit is contained in:
David Renshaw 2014-10-07 12:18:55 -04:00
parent e05c743134
commit 7adaa91435
3 changed files with 1 additions and 4 deletions

View file

@ -27,7 +27,6 @@ public final class BuilderArena implements Arena {
this.allocationStrategy = allocationStrategy;
SegmentBuilder segment0 = new SegmentBuilder(
ByteBuffer.allocate(firstSegmentSizeWords * Constants.BYTES_PER_WORD), this);
segment0.buffer.mark();
segment0.buffer.order(ByteOrder.LITTLE_ENDIAN);
this.segments.add(segment0);
}
@ -78,7 +77,6 @@ public final class BuilderArena implements Arena {
// --------
newSegment.buffer.mark();
newSegment.buffer.order(ByteOrder.LITTLE_ENDIAN);
newSegment.id = len;
this.segments.add(newSegment);

View file

@ -15,7 +15,7 @@ public final class SegmentBuilder extends SegmentReader {
// the total number of words the buffer can hold
private final int capacity() {
this.buffer.reset();
this.buffer.rewind();
return this.buffer.remaining() / 8;
}

View file

@ -90,7 +90,6 @@ class LayoutSuite extends FunSuite {
test("StructRoundTrip_OneSegment") {
val buffer = java.nio.ByteBuffer.allocate(1024 * 8);
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
buffer.mark();
val pointerBuilder = PointerBuilder.getRoot(
new SegmentBuilder(buffer, new BuilderArena(BuilderArena.SUGGESTED_FIRST_SEGMENT_WORDS,