ByteBuffer.asReadOnlyBuffer

Creates a new, read-only byte buffer that shares this buffer's content.

<p> The content of the new buffer will be that of this buffer. Changes to this buffer's content will be visible in the new buffer; the new buffer itself, however, will be read-only and will not allow the shared content to be modified. The two buffers' position, limit, and mark values will be independent.

<p> The new buffer's capacity, limit, position, and mark values will be identical to those of this buffer.

<p> If this buffer is itself read-only then this method behaves in exactly the same way as the {@link #duplicate duplicate} method. </p>

@return The new, read-only byte buffer

class ByteBuffer
abstract
asReadOnlyBuffer
()

Meta