Instance Methodswift-nio 2.72.0_NIOFileSystem
write(contentsOf:)
Write the contents of the AsyncSequence
of byte chunks to the buffer.
- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
@discardableResult mutating func write<Chunks>(contentsOf chunks: Chunks) async throws -> Int64 where Chunks : AsyncSequence, Chunks.Element : Sequence, Chunks.Element.Element == UInt8
Parameters
- bytes
The
AsyncSequence
of byte chunks to write to the buffer.
Returns
The number of bytes written into the buffered writer.
If appending a chunk to the buffer causes it to exceed the capacity of the buffer then the contents of the buffer are automatically written to the file system.
To manually flush bytes use flush
.
Other members in extension
Instance members
var bufferedBytes: Int
The number of bytes in the buffer.
let capacity: Int
The maximum number of bytes to buffer before the buffer is automatically flushed.
func flush(
) async throws Flush any buffered bytes to the file system.
func write(contentsOf: ByteBuffer
) async throws -> Int64 Write the contents of the
ByteBuffer
into the buffer.func write(contentsOf: some Sequence<UInt8>
) async throws -> Int64 Write the contents of the collection of bytes to the buffer.
func write<Chunks>(contentsOf: Chunks
) async throws -> Int64 Write the contents of the
AsyncSequence
ofByteBuffer
s into the buffer.func write<Bytes>(contentsOf: Bytes
) async throws -> Int64 Write the contents of the
AsyncSequence
of bytes the buffer.
Show system interfaces (1)
Hide system interfaces
var bufferCapacity: Int
The capacity of the buffer.