<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveStreamProtocol",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Apple Archive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B14StreamProtocolP"
  },
  "title" : "ArchiveStreamProtocol"
}
-->

# ArchiveStreamProtocol

A set of methods that defines the interface for using an archive stream that reads from and writes to data blobs.

```
protocol ArchiveStreamProtocol
```

## Topics

### Reading and Writing Blobs

[`func readBlob(key: ArchiveHeader.FieldKey, into: UnsafeMutableRawBufferPointer) throws`](/documentation/AppleArchive/ArchiveStreamProtocol/readBlob(key:into:))

Reads the current entry blob data.

[`func writeBlob(key: ArchiveHeader.FieldKey, from: UnsafeRawBufferPointer) throws`](/documentation/AppleArchive/ArchiveStreamProtocol/writeBlob(key:from:))

Writes an entry blob data.

### Reading and Writing Headers

[`func readHeader() throws -> ArchiveHeader?`](/documentation/AppleArchive/ArchiveStreamProtocol/readHeader())

Reads the next entry header.

[`func writeHeader(ArchiveHeader) throws`](/documentation/AppleArchive/ArchiveStreamProtocol/writeHeader(_:))

Writes an entry header.

### Using Archive Streams

[`func cancel()`](/documentation/AppleArchive/ArchiveStreamProtocol/cancel())

Cancels stream operations.

[`func close() throws`](/documentation/AppleArchive/ArchiveStreamProtocol/close())

Closes the stream and releases associated resources.

## Relationships

### Conforming Types

[`ArchiveStream`](/documentation/AppleArchive/ArchiveStream)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)