インタフェースjava.lang.foreign.MemorySegmentの
使用
MemorySegmentを使用するパッケージ
パッケージ
説明
Javaランタイム外部のメモリーおよびファンクションへの低レベル・アクセスを提供します。
入出力操作を実行できるエンティティ(ファイル、ソケットなど)への接続を表すチャネルや、多重化された非ブロック入出力操作用のセレクタを定義します。
インキュベート機能。 将来のリリースで削除されます。
-
java.lang.foreignでのMemorySegmentの使用
MemorySegmentとして宣言されたjava.lang.foreignのフィールドMemorySegmentを返すjava.lang.foreignのメソッド修飾子と型メソッド説明Arena.allocate(long byteSize, long byteAlignment) 指定されたサイズ(バイト単位)および整列制約(バイト単位)のネイティブ・メモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocate(long byteSize) 指定されたbyteSizeを持つ新しいメモリー・セグメントを返します。SegmentAllocator.allocate(long byteSize, long byteAlignment) 指定されたbyteSizeおよびbyteAlignmentを持つ新しいメモリー・セグメントを戻します。default MemorySegmentSegmentAllocator.allocate(MemoryLayout layout) 指定されたレイアウトを持つ新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocate(MemoryLayout elementLayout, long count) 指定されたelementLayoutおよびcountを持つ新しいメモリー・セグメントを戻します。default MemorySegmentSegmentAllocator.allocateFrom(AddressLayout layout, MemorySegment value) 指定されたメモリー・セグメントのaddressで初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfByte layout, byte value) 指定されたバイト値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfByte elementLayout, byte... elements) 指定されたバイト配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfChar layout, char value) 指定されたchar値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfChar elementLayout, char... elements) 指定されたchar配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfDouble layout, double value) 指定されたdouble値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfDouble elementLayout, double... elements) 指定されたdouble配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfFloat layout, float value) 指定されたfloat値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfFloat elementLayout, float... elements) 指定されたfloat配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfInt layout, int value) 指定されたint値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfInt elementLayout, int... elements) 指定されたint配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfLong layout, long value) 指定されたlong値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfLong elementLayout, long... elements) 指定されたlong配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfShort layout, short value) 指定されたshort値で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout.OfShort elementLayout, short... elements) 指定されたshort配列の要素で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout elementLayout, MemorySegment source, ValueLayout sourceElementLayout, long sourceOffset, long elementCount) 指定されたセグメントの内容で初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(String str) UTF-8文字セットを使用してJava文字列をNULLで終了するC文字列に変換し、その結果をメモリー・セグメントに格納します。default MemorySegmentSegmentAllocator.allocateFrom(String str, Charset charset) 指定された文字セットを使用してJava文字列をNULLで終了するC文字列に変換し、その結果をメモリー・セグメントに格納します。MemorySegment.asReadOnly()このセグメントの読取り専用ビューを返します。MemorySegment.asSlice(long offset) 指定されたオフセットで、このメモリー・セグメントのスライスを返します。MemorySegment.asSlice(long offset, long newSize) 指定されたオフセットで、このメモリー・セグメントのスライスを返します。MemorySegment.asSlice(long offset, long newSize, long byteAlignment) 指定された境界整列制約を使用して、指定されたオフセットでこのメモリー・セグメントのスライスを返します。MemorySegment.asSlice(long offset, MemoryLayout layout) 指定されたレイアウトでこのメモリー・セグメントのスライスを、指定されたオフセットで返します。MemorySegment.copyFrom(MemorySegment src) 指定されたソース・セグメントからこのセグメントへのバルク・コピーを実行します。MemorySegment.fill(byte value) このメモリー・セグメントの内容を指定された値で満たします。default MemorySegmentSymbolLookup.findOrThrow(String name) 指定された名前を持つシンボルのアドレスを返すか、例外をスローします。MemorySegment.get(AddressLayout layout, long offset) 指定されたレイアウトで、指定されたオフセットでこのセグメントからアドレスを読み取ります。MemorySegment.getAtIndex(AddressLayout layout, long index) 指定されたインデックスの指定されたセグメントからアドレスを読み取り、指定されたレイアウト・サイズでスケーリングします。static MemorySegmentMemorySegment.ofAddress(long address) 指定された「アドレス値」から長さゼロのネイティブ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(byte[] byteArray) 指定されたバイト配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(char[] charArray) 指定されたchar配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(double[] doubleArray) 指定された二重配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(float[] floatArray) 指定された浮動小数配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(int[] intArray) 指定されたint配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(long[] longArray) 指定された長い配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegmentMemorySegment.ofArray(short[] shortArray) 指定された短い配列を保持するメモリーのオン・ヒープ・リージョンによって支えられたヒープ・セグメントを作成します。static MemorySegment指定されたBufferインスタンスをバックするメモリーの同じリージョンに基づくメモリー・セグメントを作成します。MemorySegment.reinterpret(long newSize) Restricted.このセグメントと同じアドレスとスコープを持つが、指定されたサイズの新しいメモリー・セグメントを返します。MemorySegment.reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup) Restricted.このセグメントと同じアドレスで、指定されたサイズとスコープを持つ新しいセグメントを返します。MemorySegment.reinterpret(Arena arena, Consumer<MemorySegment> cleanup) Restricted.このセグメントと同じアドレスとサイズを持つが、指定されたスコープを持つ新しいメモリー・セグメントを返します。Linker.upcallStub(MethodHandle target, FunctionDescriptor function, Arena arena, Linker.Option... options) Restricted.指定されたアリーナに関連付けられた関数ポインタとして、ほかの外部関数に渡すことができるアップコール・スタブを作成します。型MemorySegmentの引数を持つ型を返すjava.lang.foreignのメソッド修飾子と型メソッド説明MemorySegment.asOverlappingSlice(MemorySegment other) このセグメントと指定されたセグメントの間の重複である、このセグメントのスライスを返します。MemorySegment.elements(MemoryLayout elementLayout) このセグメント内の分離スライス(指定したレイアウトのサイズと一致するサイズ)に対して連続したStreamを返します。指定された名前のシンボルのアドレスを返します。MemorySegment.spliterator(MemoryLayout elementLayout) このメモリー・セグメントのスプリッテレータを返します。型MemorySegmentのパラメータを持つjava.lang.foreignのメソッド修飾子と型メソッド説明default MemorySegmentSegmentAllocator.allocateFrom(AddressLayout layout, MemorySegment value) 指定されたメモリー・セグメントのaddressで初期化された新しいメモリー・セグメントを返します。default MemorySegmentSegmentAllocator.allocateFrom(ValueLayout elementLayout, MemorySegment source, ValueLayout sourceElementLayout, long sourceOffset, long elementCount) 指定されたセグメントの内容で初期化された新しいメモリー・セグメントを返します。MemorySegment.asOverlappingSlice(MemorySegment other) このセグメントと指定されたセグメントの間の重複である、このセグメントのスライスを返します。static voidMemorySegment.copy(MemorySegment srcSegment, long srcOffset, MemorySegment dstSegment, long dstOffset, long bytes) ソース・セグメントから宛先セグメントへの一括コピーを実行します。static voidMemorySegment.copy(MemorySegment srcSegment, ValueLayout srcElementLayout, long srcOffset, MemorySegment dstSegment, ValueLayout dstElementLayout, long dstOffset, long elementCount) ソース・セグメントから宛先セグメントへの一括コピーを実行します。static voidMemorySegment.copy(MemorySegment srcSegment, ValueLayout srcLayout, long srcOffset, Object dstArray, int dstIndex, int elementCount) ソース・メモリー・セグメントから宛先配列に多数の要素をコピーします。static voidMemorySegment.copy(Object srcArray, int srcIndex, MemorySegment dstSegment, ValueLayout dstLayout, long dstOffset, int elementCount) ソース配列から宛先メモリー・セグメントに多数の要素をコピーします。MemorySegment.copyFrom(MemorySegment src) 指定されたソース・セグメントからこのセグメントへのバルク・コピーを実行します。Linker.downcallHandle(MemorySegment address, FunctionDescriptor function, Linker.Option... options) Restricted.指定されたシグネチャおよびアドレスを持つ外部ファンクションをコールするために使用されるメソッド・ハンドルを作成します。longMemorySegment.mismatch(MemorySegment other) このセグメントと指定された他のセグメントとの間で最初の不一致のオフセットをバイト単位で検索して返します。static longMemorySegment.mismatch(MemorySegment srcSegment, long srcFromOffset, long srcToOffset, MemorySegment dstSegment, long dstFromOffset, long dstToOffset) ソース・セグメントと宛先セグメント間の最初の不一致の相対オフセットをバイト単位で検索して返します。static SegmentAllocatorSegmentAllocator.prefixAllocator(MemorySegment segment) 単一のセグメントをリサイクルして配賦リクエストに応答するセグメント・ロケータを返します。voidMemorySegment.set(AddressLayout layout, long offset, MemorySegment value) 指定されたレイアウトを使用して、指定されたオフセットでこのセグメントにアドレスを書き込みます。voidMemorySegment.setAtIndex(AddressLayout layout, long index, MemorySegment value) 指定された索引で、指定されたレイアウト・サイズでスケールされたアドレスをこのセグメントに書き込みます。static SegmentAllocatorSegmentAllocator.slicingAllocator(MemorySegment segment) 指定されたセグメントから取得された連続したスライスを返すことによって、配賦リクエストに応答するセグメント・ロケータを返します。型MemorySegmentの型引数を持つjava.lang.foreignのメソッド・パラメータ修飾子と型メソッド説明MemorySegment.reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup) Restricted.このセグメントと同じアドレスで、指定されたサイズとスコープを持つ新しいセグメントを返します。MemorySegment.reinterpret(Arena arena, Consumer<MemorySegment> cleanup) Restricted.このセグメントと同じアドレスとサイズを持つが、指定されたスコープを持つ新しいメモリー・セグメントを返します。 -
java.nio.channelsでのMemorySegmentの使用
MemorySegmentを返すjava.nio.channelsのメソッド修飾子と型メソッド説明FileChannel.map(FileChannel.MapMode mode, long offset, long size, Arena arena) 指定されたオフセット、サイズおよびアリーナを使用して、このチャネルのファイルのリージョンを新しいマップされたメモリー・セグメントにマップします。 -
jdk.incubator.vectorでのMemorySegmentの使用
型MemorySegmentのパラメータを持つjdk.incubator.vectorのメソッド修飾子と型メソッド説明static ByteVectorByteVector.fromMemorySegment(VectorSpecies<Byte> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static ByteVectorByteVector.fromMemorySegment(VectorSpecies<Byte> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Byte> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。static DoubleVectorDoubleVector.fromMemorySegment(VectorSpecies<Double> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static DoubleVectorDoubleVector.fromMemorySegment(VectorSpecies<Double> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Double> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。static FloatVectorFloatVector.fromMemorySegment(VectorSpecies<Float> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static FloatVectorFloatVector.fromMemorySegment(VectorSpecies<Float> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Float> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。static IntVectorIntVector.fromMemorySegment(VectorSpecies<Integer> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static IntVectorIntVector.fromMemorySegment(VectorSpecies<Integer> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Integer> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。static LongVectorLongVector.fromMemorySegment(VectorSpecies<Long> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static LongVectorLongVector.fromMemorySegment(VectorSpecies<Long> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Long> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。static ShortVectorShortVector.fromMemorySegment(VectorSpecies<Short> species, MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からベクトルをメモリー・セグメントにロードします。static ShortVectorShortVector.fromMemorySegment(VectorSpecies<Short> species, MemorySegment ms, long offset, ByteOrder bo, VectorMask<Short> m) オフセットから始まる「メモリー・セグメント」からメモリー・セグメントにベクトルをロードし、マスクを使用します。VectorSpecies.fromMemorySegment(MemorySegment ms, long offset, ByteOrder bo) オフセットから始まる「メモリー・セグメント」からこの種のベクトルをメモリー・セグメントにロードします。final voidByteVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidByteVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Byte> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidDoubleVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidDoubleVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Double> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidFloatVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidFloatVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Float> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidIntVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidIntVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Integer> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidLongVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidLongVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Long> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidShortVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。final voidShortVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<Short> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。abstract voidVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo) このベクトルを、明示的なバイト順序を使用してオフセットから始まる「メモリー・セグメント」に格納します。abstract voidVector.intoMemorySegment(MemorySegment ms, long offset, ByteOrder bo, VectorMask<E> m) このベクトルを、明示的なバイト順序とマスクを使用してオフセットから始まる「メモリー・セグメント」に格納します。