writeUUIDBytes(_:)
Write a UUID info the buffer and advances the writer index.
@discardableResult mutating func writeUUIDBytes(_ uuid: UUID) -> Int Parameters
- uuid
The
UUIDto write into the buffer.
Returns
The number of bytes written.
Write a UUID info the buffer and advances the writer index.
@discardableResult mutating func writeUUIDBytes(_ uuid: UUID) -> Int s7NIOCore10ByteBufferV19NIOFoundationCompatE14writeUUIDBytesySi20FoundationEssentials4UUIDVF What are these?A1HKThe UUID to write into the buffer.
The number of bytes written.
import NIOCoreThe core abstractions that make up SwiftNIO.
import NIOFoundationCompatstruct ByteBufferByteBuffer stores contiguously allocated raw bytes. It is a random and sequential accessible sequence of zero or more bytes (octets).
@frozen struct IntA signed integer value type.
init(data: Data) func getData(at index: Int, length: Int) -> Data? Return length bytes starting at index and return the result as Data. This will not change the reader index. The selected bytes must be readable or else nil will be returned.
func getData(at index: Int, length: Int, byteTransferStrategy: ByteBuffer.ByteTransferStrategy) -> Data? Return length bytes starting at index and return the result as Data. This will not change the reader index. The selected bytes must be readable or else nil will be returned.
func getJSONDecodable<T>(_ type: T.Type, decoder: JSONDecoder = JSONDecoder(), at index: Int, length: Int) throws -> T? where T : Decodable Attempts to decode the length bytes from index using the JSONDecoder decoder as T.
func getString(at index: Int, length: Int, encoding: String.Encoding) -> String? Get a String decoding length bytes starting at index with encoding. This will not change the reader index. The selected bytes must be readable or else nil will be returned.
func getUUIDBytes(at index: Int) -> UUID? Get a UUID from the 16 bytes starting at index. This will not change the reader index. If there are less than 16 bytes starting at index then nil will be returned.
func peekData(length: Int, byteTransferStrategy: ByteBuffer.ByteTransferStrategy) -> Data? Return length bytes starting at the current readerIndex as Data. This will not change the reader index.
func peekUUIDBytes() -> UUID? Get a UUID from the 16 bytes starting at the current readerIndex. Does not move the reader index.
mutating func readData(length: Int) -> Data? Read length bytes off this ByteBuffer, move the reader index forward by length bytes and return the result as Data.
mutating func readData(length: Int, byteTransferStrategy: ByteBuffer.ByteTransferStrategy) -> Data? Read length bytes off this ByteBuffer, move the reader index forward by length bytes and return the result as Data.
mutating func readJSONDecodable<T>(_ type: T.Type, decoder: JSONDecoder = JSONDecoder(), length: Int) throws -> T? where T : Decodable Reads length bytes from this ByteBuffer and then attempts to decode them using the JSONDecoder decoder.
mutating func readString(length: Int, encoding: String.Encoding) -> String? Read a String decoding length bytes with encoding from the readerIndex, moving the readerIndex appropriately.
mutating func readUUIDBytes() -> UUID? Read a UUID from the first 16 bytes in the buffer. Advances the reader index.
@discardableResult mutating func setContiguousBytes<Bytes>(_ bytes: Bytes, at index: Int) -> Int where Bytes : ContiguousBytes Write bytes into this ByteBuffer at index. Does not move the writer index.
@discardableResult mutating func setData<D>(_ data: D, at index: Int) -> Int where D : DataProtocol Write the bytes of data into this ByteBuffer at index. Does not move the writer index.
@discardableResult mutating func setJSONEncodable<T>(_ value: T, encoder: JSONEncoder = JSONEncoder(), at index: Int) throws -> Int where T : Encodable Encodes value using the JSONEncoder encoder and set the resulting bytes into this ByteBuffer at the given index.
@discardableResult mutating func setString(_ string: String, encoding: String.Encoding, at index: Int) throws -> Int Write string into this ByteBuffer at index using the encoding encoding. Does not move the writer index.
@discardableResult mutating func setUUIDBytes(_ uuid: UUID, at index: Int) -> Int Set the bytes of the UUID into this ByteBuffer at index, allocating more storage if necessary. Does not move the writer index.
@discardableResult mutating func writeContiguousBytes<Bytes>(_ bytes: Bytes) -> Int where Bytes : ContiguousBytes Write bytes into this ByteBuffer at the writer index, moving the writer index forward appropriately.
@discardableResult mutating func writeData<D>(_ data: D) -> Int where D : DataProtocol Write the bytes of data into this ByteBuffer at the writer index, moving the writer index forward appropriately.
@discardableResult mutating func writeJSONEncodable<T>(_ value: T, encoder: JSONEncoder = JSONEncoder()) throws -> Int where T : Encodable Encodes value using the JSONEncoder encoder and writes the resulting bytes into this ByteBuffer.
@discardableResult mutating func writeString(_ string: String, encoding: String.Encoding) throws -> Int Write string into this ByteBuffer using the encoding encoding, moving the writer index forward appropriately.
enum ByteTransferStrategyControls how bytes are transferred between ByteBuffer and other storage types.