One Logo Pool Ball
CoreMedia · IOS API REFERENCE

CMReadOnlyDataBlockBuffer

struct · iOS 26.0+ · SDK 27.1

struct CMReadOnlyDataBlockBuffer

A block buffer that provides read-only access to the a range of bytes. Block buffer provides a contiguous range of data offsets (from 0 to ``count``) across a possibly non-contiguous range of bytes. The byte range may contain memory blocks and buffer references. The bytes held by this buffer can not be modified. However, the composition of the byte range can be changed by appending other memory blocks or buffer references.

Members (17)

method · iOS 26.0+

withUnsafeBlockBuffer

TypeScript
withUnsafeBlockBuffer(body: ((arg0: CMBlockBuffer) => unknown)): unknown
Swift declaration
func withUnsafeBlockBuffer<R>(_ body: (CMBlockBuffer) throws -> sending R) rethrows -> sending R where R : ~Copyable

Access the underlying CMBlockBuffer instance.

init · iOS 26.0+

init

TypeScript
static initSubBlockCapacity(subBlockCapacity?: number): CMReadOnlyDataBlockBuffer
Swift declaration
init(subBlockCapacity: Int = 0)

Create empty block buffer. - Parameter subBlockCapacity: Minimum number of sub blocks in this block buffer.

init · iOS 26.0+

init

TypeScript
static initUnsafeBlockBuffer(unsafeBlockBuffer: CMBlockBuffer): CMReadOnlyDataBlockBuffer
Swift declaration
init(unsafeBlockBuffer: sending CMBlockBuffer)

Create a readonly block buffer from an existing block buffer. This init will make sure that all memory referenced by `unsafeBlockBuffer` is allocated by calling ``CMBlockBuffer/assureBlockMemory()``. - Parameter unsafeBlockBuffer: The ``CMBlockBuffer`` which will be subsumed by the new instance.

get · iOS 26.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element.

get · iOS 26.0+

isContiguous

TypeScript
get isContiguous(): boolean
Swift declaration
var isContiguous: Bool { get }

Determine whether the block buffer is contiguous. `true` if block buffer references a single contiguous memory block `false` otherwise. Also `false` if the buffer is empty.

method · iOS 26.0+

withContiguousStorageIfAvailable

TypeScript
withContiguousStorageIfAvailable(body: ((arg0: Uint8Array) => unknown)): (unknown) | null
Swift declaration
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeBufferPointer<UInt8>) throws -> R) rethrows -> R?

Access contents of the buffer if available as contiguous memory block. This method calls body(buffer), where buffer is a pointer to the block buffers contiguous storage. If the contiguous storage doesn’t exist, the method doesn’t call body — it immediately returns nil.

method · iOS 26.0+

withContiguousStorageIfAvailable

TypeScript
withContiguousStorageIfAvailable29373(body: ((arg0: ArrayBuffer) => unknown)): (unknown) | null
Swift declaration
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeRawBufferPointer) throws -> sending R) rethrows -> sending R?

Access contents of the buffer if available as contiguous memory block. This method calls body(buffer), where buffer is a pointer to the block buffers contiguous storage. If the contiguous storage doesn’t exist, the method doesn’t call body — it immediately returns nil.

get · iOS 26.0+

count

TypeScript
get count(): number
Swift declaration
var count: Int { get }

The number of bytes in the block buffer. This count is the sum of the number of bytes in each memory block and buffer reference held in the block buffer. Note that the buffer references may hold more data than referenced by this block buffer. This block buffer presents a contiguous range of offsets from 0 to `count`.

method · iOS 26.0+

append

TypeScript
append(other: CMReadOnlyDataBlockBuffer, optimizeDepth?: boolean): void
Swift declaration
mutating func append(referenceOf other: CMReadOnlyDataBlockBuffer, optimizeDepth: Bool = true)

Append a reference to a range of another block buffer. The range within the block buffer is not required to be contiguous. Providing out of bounds range will result in a precondition failure. - Parameter referenceOf: Other block buffer to be referenced by this block buffer. - Parameter optimizeDepth: Keep the depth of buffer reference graph to a minimum.

get · iOS 26.0+

indices

TypeScript
get indices(): SDKHandle
Swift declaration
var indices: Range<Int> { get }

The indices that are valid for subscripting the collection, in ascending order.

get · iOS 26.0+

isEmpty

TypeScript
get isEmpty(): boolean
Swift declaration
var isEmpty: Bool { get }

Indicates whether the block buffer is empty. Indicates whether the block buffer is empty, i.e., devoid of any memory blocks or block buffer references. Note that a block buffer containing a not-yet allocated memory block is not considered empty.

get · iOS 26.0+

regions

TypeScript
get regions(): Array<CMReadOnlyDataBlockBuffer_BlockRegion>
Swift declaration
var regions: [CMReadOnlyDataBlockBuffer.BlockRegion] { get }

The regions that make up the storage of the block buffer.

get · iOS 26.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The position one greater than the last valid subscript argument.

init · iOS 26.0+

init

TypeScript
static init(data: ArrayBuffer): CMReadOnlyDataBlockBuffer
Swift declaration
init(_ data: Data)

Create a new block buffer referencing bytes from Data.

init · iOS 26.0+

init

TypeScript
static init70806(dispatchData: _Dispatch_DispatchData): CMReadOnlyDataBlockBuffer
Swift declaration
init(_ dispatchData: DispatchData)
subscript · iOS 26.0+

subscript

TypeScript
subscript(range: SDKHandle): CMReadOnlyDataBlockBuffer
Swift declaration
subscript(range: Range<CMReadOnlyDataBlockBuffer.Index>) -> CMReadOnlyDataBlockBuffer { get }

Creates a new block buffer that references a subrange of this block buffer.

subscript · iOS 26.0+

subscript

TypeScript
subscript25927(position: number): number
Swift declaration
subscript(position: CMReadOnlyDataBlockBuffer.Index) -> UInt8 { get }

Accesses the data byte at the specified position.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CMReadOnlyDataBlockBuffer.init(_:)

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'CMMutableDataBlockBuffer' conform to 'Copyable'

CMReadOnlyDataBlockBuffer.append(referenceOf:optimizeDepth:)

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'CMMutableDataBlockBuffer' conform to 'Copyable'

CMReadOnlyDataBlockBuffer.attachments

The iOS SDK compiler rejected this binding: instance method 'out' requires that 'CMReadOnlyDataBlockBuffer.Attachments' (aka 'CVAttachmentAccess<CMBlockBufferAttachmentKeyDefinitions>') be a class type

CMReadOnlyDataBlockBuffer.attachments

The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'CMReadOnlyDataBlockBuffer.Attachments' (aka 'CVAttachmentAccess<CMBlockBufferAttachmentKeyDefinitions>') conform to 'Escapable'

All CoreMedia types →