Skip to content

Commit

Permalink
NoSuchMethodError: java.nio.MappedByteBuffer.duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
vharseko committed Dec 17, 2024
1 parent d46cd38 commit d47b006
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.lang.reflect.Method;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
Expand Down Expand Up @@ -1510,7 +1511,7 @@ public MeteredCursor<ByteString, ByteString> flip()
mmapPosition = region.offset;
mmap = channel.map(MapMode.READ_ONLY, mmapPosition, Math.min(size.get() - mmapPosition, Integer.MAX_VALUE));
}
final ByteBuffer regionBuffer = mmap.duplicate();
final ByteBuffer regionBuffer = ((ByteBuffer)mmap).duplicate();
final int relativeRegionOffset = (int) (region.offset - mmapPosition);
regionBuffer.position(relativeRegionOffset).limit(regionBuffer.position() + region.size);
cursors.add(new FileRegion.Cursor(name, regionBuffer.slice()));
Expand Down

0 comments on commit d47b006

Please sign in to comment.