stop using ByteBuffer.mark()
This commit is contained in:
parent
e05c743134
commit
7adaa91435
3 changed files with 1 additions and 4 deletions
|
@ -27,7 +27,6 @@ public final class BuilderArena implements Arena {
|
||||||
this.allocationStrategy = allocationStrategy;
|
this.allocationStrategy = allocationStrategy;
|
||||||
SegmentBuilder segment0 = new SegmentBuilder(
|
SegmentBuilder segment0 = new SegmentBuilder(
|
||||||
ByteBuffer.allocate(firstSegmentSizeWords * Constants.BYTES_PER_WORD), this);
|
ByteBuffer.allocate(firstSegmentSizeWords * Constants.BYTES_PER_WORD), this);
|
||||||
segment0.buffer.mark();
|
|
||||||
segment0.buffer.order(ByteOrder.LITTLE_ENDIAN);
|
segment0.buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
this.segments.add(segment0);
|
this.segments.add(segment0);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +77,6 @@ public final class BuilderArena implements Arena {
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
|
|
||||||
newSegment.buffer.mark();
|
|
||||||
newSegment.buffer.order(ByteOrder.LITTLE_ENDIAN);
|
newSegment.buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||||
newSegment.id = len;
|
newSegment.id = len;
|
||||||
this.segments.add(newSegment);
|
this.segments.add(newSegment);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public final class SegmentBuilder extends SegmentReader {
|
||||||
|
|
||||||
// the total number of words the buffer can hold
|
// the total number of words the buffer can hold
|
||||||
private final int capacity() {
|
private final int capacity() {
|
||||||
this.buffer.reset();
|
this.buffer.rewind();
|
||||||
return this.buffer.remaining() / 8;
|
return this.buffer.remaining() / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ class LayoutSuite extends FunSuite {
|
||||||
test("StructRoundTrip_OneSegment") {
|
test("StructRoundTrip_OneSegment") {
|
||||||
val buffer = java.nio.ByteBuffer.allocate(1024 * 8);
|
val buffer = java.nio.ByteBuffer.allocate(1024 * 8);
|
||||||
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
|
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
|
||||||
buffer.mark();
|
|
||||||
|
|
||||||
val pointerBuilder = PointerBuilder.getRoot(
|
val pointerBuilder = PointerBuilder.getRoot(
|
||||||
new SegmentBuilder(buffer, new BuilderArena(BuilderArena.SUGGESTED_FIRST_SEGMENT_WORDS,
|
new SegmentBuilder(buffer, new BuilderArena(BuilderArena.SUGGESTED_FIRST_SEGMENT_WORDS,
|
||||||
|
|
Loading…
Reference in a new issue