---
title: "withContiguousStorageIfAvailable(_:)"
framework: coremedia
role: symbol
role_heading: Instance Method
path: "coremedia/cmreadonlydatablockbuffer/withcontiguousstorageifavailable(_:)-7tacg"
---

# withContiguousStorageIfAvailable(_:)

Access contents of the buffer if available as contiguous memory block.

## Declaration

```swift
func withContiguousStorageIfAvailable<R>(_ body: (UnsafeRawBufferPointer) throws -> sending R) rethrows -> sending R?
```

## Discussion

Discussion 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.
