< prev index next >

src/java.base/share/classes/jdk/internal/access/JavaNioAccess.java

Print this page




  30 import java.nio.Buffer;
  31 import java.nio.ByteBuffer;
  32 
  33 public interface JavaNioAccess {
  34     /**
  35      * Provides access to information on buffer usage.
  36      */
  37     interface BufferPool {
  38         String getName();
  39         long getCount();
  40         long getTotalCapacity();
  41         long getMemoryUsed();
  42     }
  43     BufferPool getDirectBufferPool();
  44 
  45     /**
  46      * Constructs a direct ByteBuffer referring to the block of memory starting
  47      * at the given memory address and extending {@code cap} bytes.
  48      * The {@code ob} parameter is an arbitrary object that is attached
  49      * to the resulting buffer.

  50      */
  51     ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob, MemorySegmentProxy segment);
  52 
  53     /**
  54      * Constructs an heap ByteBuffer with given backing array, offset, capacity and segment.

  55      */
  56     ByteBuffer newHeapByteBuffer(byte[] hb, int offset, int capacity, MemorySegmentProxy segment);
  57 



  58     Object getBufferBase(ByteBuffer bb);
  59 



  60     long getBufferAddress(ByteBuffer bb);
  61 



  62     void checkSegment(Buffer buffer);
  63 }


  30 import java.nio.Buffer;
  31 import java.nio.ByteBuffer;
  32 
  33 public interface JavaNioAccess {
  34     /**
  35      * Provides access to information on buffer usage.
  36      */
  37     interface BufferPool {
  38         String getName();
  39         long getCount();
  40         long getTotalCapacity();
  41         long getMemoryUsed();
  42     }
  43     BufferPool getDirectBufferPool();
  44 
  45     /**
  46      * Constructs a direct ByteBuffer referring to the block of memory starting
  47      * at the given memory address and extending {@code cap} bytes.
  48      * The {@code ob} parameter is an arbitrary object that is attached
  49      * to the resulting buffer.
  50      * Used by {@code jdk.internal.foreignMemorySegmentImpl}.
  51      */
  52     ByteBuffer newDirectByteBuffer(long addr, int cap, Object obj, MemorySegmentProxy segment);
  53 
  54     /**
  55      * Constructs an heap ByteBuffer with given backing array, offset, capacity and segment.
  56      * Used by {@code jdk.internal.foreignMemorySegmentImpl}.
  57      */
  58     ByteBuffer newHeapByteBuffer(byte[] hb, int offset, int capacity, MemorySegmentProxy segment);
  59 
  60     /**
  61      * Used by {@code jdk.internal.foreign.Utils}.
  62      */
  63     Object getBufferBase(ByteBuffer bb);
  64 
  65     /**
  66      * Used by {@code jdk.internal.foreign.Utils}.
  67      */
  68     long getBufferAddress(ByteBuffer bb);
  69 
  70     /**
  71      * Used by byte buffer var handle views.
  72      */
  73     void checkSegment(Buffer buffer);
  74 }
< prev index next >