Data

@frozen
extension Data
  • Truncates or pads with the Data object from the left until the given sized is reached.

    Precondition

    targetByteCount must be greater than or equal to 0

    Declaration

    Swift

    public func normalize(to targetByteCount: Int, paddingIndicator: UInt8 = 0x0) -> Data

    Parameters

    targetByteCount

    Length to which the Data is truncated or padded with zero-bytes. Must be greater or equal to zero.

    paddingIndicator

    Byte to pad the given Data, if the length not sufficient

    Return Value

    The Data with the given size