---
title: "write(from:atOffset:)"
framework: applearchive
role: symbol
role_heading: Instance Method
path: "applearchive/archivebytestreamprotocol/write(from:atoffset:)"
---

# write(from:atOffset:)

Writes data at the supplied offset from the specified buffer, not exceeding the buffer’s allocated size.

## Declaration

```swift
func write(from buffer: UnsafeRawBufferPointer, atOffset offset: Int64) throws -> Int
```

## Parameters

- `buffer`: The data buffer that the operation uses as a source for the data.
- `offset`: The stream position of the segment that the operation writes.

## Return Value

Return Value The number of bytes written by the stream.

## See Also

### Reading and Writing Data

- [read(into:)](applearchive/archivebytestreamprotocol/read(into:).md)
- [read(into:atOffset:)](applearchive/archivebytestreamprotocol/read(into:atoffset:).md)
- [write(from:)](applearchive/archivebytestreamprotocol/write(from:).md)
