init(integer:endianness:as:)

    Create a fresh ByteBuffer containing the bytes of the byte representation in the given endianness of integer.

    ByteBuffer-aux.swift:640
    init<I>(integer: I, endianness: Endianness = .big, as: I.Type = I.self) where I : FixedWidthInteger

    This will allocate a new ByteBuffer with enough space to fit integer 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(integer:). 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 writeInteger 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