init(string:)

    Create a fresh ByteBuffer containing the bytes of the string encoded as UTF-8.

    ByteBuffer-aux.swift:579
    init(string: String)

    This will allocate a new ByteBuffer with enough space to fit string and potentially some extra space using the default allocator.

    • info: If you have access to a Channel, ChannelHandlerContext, or ByteBufferAllocator we recommend using channel.allocator.buffer(string:). Or if you want to write multiple items into the buffer use channel.allocator.buffer(capacity: ...) to allocate a ByteBuffer of the right size followed by a writeString instead of using this method. This allows SwiftNIO to do accounting and optimisations of resources acquired for operations on a given Channel in the future.

    Other members in extension

    Types

    Typealiases

    Show implementation details (2)

    Hide implementation details

    Type members

    Instance members

    Show obsolete interfaces (3)

    Hide obsolete interfaces