API reference
API reference
Select your platform
No SDKs available
No versions available

MappedByteBufferInputStream Class

Extends InputStream
Modifiers: final
Read-only InputStream backed by a ByteBuffer (typically a MappedByteBuffer from PakManager.mapWhole). Reads advance the buffer's position; mark/reset is supported via the buffer's mark()/reset().
Used by PakManager.openInputStream to expose the pak mmap zero-copy path through the standard InputStream interface — every Kotlin asset reader that already calls openInputStream (GLXFFileLoader, LocalizedAssetResolver, etc.) gets the win without changes.
The buffer is stored by reference, so the underlying mmap region (kept alive by FileChannel's internal cleaner on the MappedByteBuffer) survives until this stream is GC'd.

Signature

class MappedByteBufferInputStream(buffer: ByteBuffer) : InputStream

Constructors

MappedByteBufferInputStream ( buffer )
Signature
constructor(buffer: ByteBuffer)
Parameters
buffer: ByteBuffer

Methods

available ()
Signature
open override fun available(): Int
Returns
Int
close ()
Signature
open override fun close()
mark ( readlimit )
Signature
open override fun mark(readlimit: Int)
Parameters
readlimit: Int
markSupported ()
Signature
open override fun markSupported(): Boolean
Returns
Boolean
read ()
Signature
open override fun read(): Int
Returns
Int
read ( b , off , len )
Signature
open override fun read(b: ByteArray, off: Int, len: Int): Int
Parameters
b: ByteArray
off: Int
len: Int
Returns
Int
read ( p0 )
Signature
open fun read(p0: ByteArray): Int
Parameters
p0: ByteArray
Returns
Int
readAllBytes ()
Signature
open fun readAllBytes(): ByteArray
Returns
ByteArray
readNBytes ( p0 )
Signature
open fun readNBytes(p0: Int): ByteArray
Parameters
p0: Int
Returns
ByteArray
readNBytes ( p0 , p1 , p2 )
Signature
open fun readNBytes(p0: ByteArray, p1: Int, p2: Int): Int
Parameters
p0: ByteArray
p1: Int
p2: Int
Returns
Int
reset ()
Signature
open override fun reset()
skip ( n )
Signature
open override fun skip(n: Long): Long
Parameters
n: Long
Returns
Long
transferTo ( p0 )
Signature
open fun transferTo(p0: OutputStream): Long
Parameters
p0: OutputStream
Returns
Long