Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IByteBuffer

interface IByteBuffer
Extends ICloseable Shareable opaque bag of bytes supporting native access. We normally use u8 to refer to opaque bags of bytes, but u8[] is a value type. IByteBuffer is a reference type.

Methods

getSize()

i32 getSize()

Returns

i32 number of bytes in the byte buffer

isSealed()

bool isSealed()
A sealed buffer is one for which the OS guarantees that the contents of the buffer cannot change. It is important for security to check that a buffer cannot change before performing certain operations using read mappings, e.g. parsing a complex file embedded in the byte buffer. Without sealing, an attacker may be able to change the contents of a byte buffer “underneath” a reader and cause the reader to misbehave.

Returns

bool whether we guarantee the contents of the buffer don’t change during read

read()

void read(i32 offset, out u8[] bytes)
Read bytes from the byte buffer into an array. This method exists to ensure that all language bindings, even those that can’t use unsafe pointers, can retrieve bytes from a byte buffer. Note that the maximum size of the read is the size of the bytes parameter. Pass a smaller ArrayView (or your language binding’s view) to read less. It is a contract violation to request bytes beyond the end of the byte buffer.

Parameters

offset
i32 — Required offset into the byte buffer
bytes (out)
u8[] — Required buffer into which to place bytes

mapForRead()

IByteBufferMapping* mapForRead()
Make a read-only mapping of the byte buffer. A mapping object encapsulates mapping the content of a byte buffer into the calling process’s address space. See IByteBufferMapping for details.

Returns

IByteBufferMapping* mapping object
Last modified on October 29, 2026