On implementing interfaces like "SeekableByteChannel" for MemorySegment's
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Fri Sep 9 13:57:36 UTC 2022
Hi Gavin,
for now we have no plans to provide I/O APIs to take memory segments
instead of buffers.
When working with I/O it is preferrable to map the segment into a buffer
(which is a very cheap operation, no copy is required, only a view is
created).
Maurizio
On 09/09/2022 14:46, Gavin Ray wrote:
> We can see in the JavaDoc for FileChannel that "transferTo/From" is
> the way to use potentially optimal I/O transfers
> This requires a Readable/Writeable/SeekableByteChannel, which have
> "ByteBuffer" as the argument types
>
> Are there any plans to eventually modify I/O API's to take raw
> MemorySegment's for better performance?
> Or should folks just do MemorySegment.ofBuffer() etc?
>
More information about the panama-dev
mailing list