diff --git a/docs/Classes.html b/docs/Classes.html index 0f9fd13..192a742 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -56,6 +56,18 @@ + + + + @@ -256,6 +268,187 @@

Declaration

+
  • +
    + + + + BinaryFileDecoder + +
    +
    +
    +
    +
    +
    +

    Read elements from a binary file.

    + +

    The decoder allows reading individual elements from a file without loading all file data to memory all at once. +This decreases memory usage, which is especially useful for large files. +Elements can also be read all at once, and corrupted files can be read until the first decoding error occurs.

    + +

    The class internally uses BinaryStreamDecoder to encode the individual elements, +which can also be used independently to decode the data for more complex operations.

    + +

    Handling corrupted data

    + +

    The binary format does not necessarily allow detection of data corruption, and various errors can occur +as the result of added, changed, or missing bytes. Additional measures should be applied if there is an +increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key +followed by the length of the string in bytes, and the string content. The length of the string is encoded using +variable length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, +causing the decoder to wait for a very large number of bytes to decode the string. This simple error would cause much +data to be skipped. At the same time, it is not possible to determine with certainty where the error occured.

    + +

    The library does therefore only provide hints about the decoding errors likely occuring from non-conformance to the binary format +or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    +
    +

    Note

    + This class is compatible with BinaryFileEncoder and BinaryStreamEncoder, +but not with the outputs of BinaryEncoder. + +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryFileDecoder<Element> where Element : Decodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryFileEncoder + +
    +
    +
    +
    +
    +
    +

    Encode a stream of elements to a binary file.

    + +

    This class complements BinaryStreamEncoder to directly write encoded elements to a file.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryFileEncoder<Element> where Element : Encodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryStreamDecoder + +
    +
    +
    +
    +
    +
    +

    Decode elements from a byte stream.

    + +

    Stream decoding can be used when either the data is not regularly available completely (e.g. when loading data over a network connection), +or when the binary data should not be loaded into memory all at once (e.g. when parsing a file).

    + +

    Each stream decoder handles only elements of a single type. +The elements are handed to a handler passed to the decoder upon initialization. +The byte stream is managed by a provider also specified on object creation. +The decoder can then attempt to read elements by reading bytes from the provider, until a complete element can be decoded. +Buffering is handled internally, freeing the stream provider from this responsibility. +Each completely decoded element is immediatelly passed to handler for further processing.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryStreamDecoder<Element> where Element : Decodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryStreamEncoder + +
    +
    +
    +
    +
    +
    +

    Encode elements sequentially into a binary data stream.

    + +

    A stream encoder is used to encode individual elements of the same type to a continuous binary stream, +which can be decoded sequentially.

    + +

    The encoding behaviour is different to BinaryEncoder, where the full data must be present to successfully decode. +Additional information is embedded into the stream to facilitate this behaviour. +The binary data produced by a stream encoder is not compatible with BinaryDecoder and can only be decoded using +BinaryStreamDecoder.

    + +

    The special data format of an encoded stream also allows joining sequences of encoded data, where: +encode([a,b]) + encode([c,d]) == encode([a,b,c,d]) and decode(encode([a]) + encode([b])) == [a,b]

    + +

    Example:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let encoded1 = try encoder.encode(1)
    +
    +let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(encoded1)
    +print(decoded1) // [1]
    +
    +let encoded2 = try encoder.encode(contentsOf: [2,3])
    +let decoded2 = try decoder.decode(encoded2)
    +print(decoded2) // [2,3]
    +
    +
    +

    Note

    + Stream decoders always work on a single type, because no type information is encoded into the data. + +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryStreamEncoder<Element> where Element : Encodable
    + +
    +
    +
    +
    +
  • @@ -355,7 +548,7 @@

    Declaration

    diff --git a/docs/Classes/BinaryDecoder.html b/docs/Classes/BinaryDecoder.html index 37026f2..2ddd56c 100644 --- a/docs/Classes/BinaryDecoder.html +++ b/docs/Classes/BinaryDecoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -224,6 +236,45 @@

    Declaration

    +
  • +
    + + + + containsNilIndexSetForUnkeyedContainers + +
    +
    +
    +
    +
    +
    +

    Assumes that unkeyed containers are encoded using a set of indices for nil values.

    + +

    Refer to the prependNilIndexSetForUnkeyedContainers property of BinaryEncoder +for more information about the binary data format in both cases.

    +
    +

    Note

    + This option defaults to true + +
    +

    Note

    + To decode successfully, the encoder must use the same setting for prependNilIndexSetForUnkeyedContainers. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var containsNilIndexSetForUnkeyedContainers: Bool
    + +
    +
    +
    +
    +
  • @@ -395,7 +446,7 @@

    Return Value

    diff --git a/docs/Classes/BinaryEncoder.html b/docs/Classes/BinaryEncoder.html index 0f4c824..af37b2a 100644 --- a/docs/Classes/BinaryEncoder.html +++ b/docs/Classes/BinaryEncoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -233,6 +245,53 @@

    Declaration

    +
  • +
    + + + + prependNilIndexSetForUnkeyedContainers + +
    +
    +
    +
    +
    +
    +

    Add a set of indices for nil values in unkeyed containers.

    + +

    This option changes the encoding of unkeyed sequences like arrays with optional values.

    + +

    If this option is set to true, then the encoded binary data first contains a list of indexes for each position where nil is encoded. +After this data the remaining (non-nil) values are added. +If this option is false, then each value is prepended with a byte 1 for non-nil values, and a byte 0 for nil values.

    + +

    Using an index set is generally more efficient, expect for large sequences with many nil values. +An index set is encoded using first the number of elements, and then each element, all encoded as var-ints.

    + +

    One benefit of this option is that top-level sequences can be joined using their binary data, where encoded([a,b]) | encoded([c,d]) == encoded([a,b,c,d]).

    +
    +

    Note

    + This option defaults to true + +
    +

    Note

    + To decode successfully, the decoder must use the same setting for containsNilIndexSetForUnkeyedContainers. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var prependNilIndexSetForUnkeyedContainers: Bool
    + +
    +
    +
    +
    +
  • @@ -412,7 +471,7 @@

    Return Value

    diff --git a/docs/Classes/BinaryFileDecoder.html b/docs/Classes/BinaryFileDecoder.html new file mode 100644 index 0000000..850ebca --- /dev/null +++ b/docs/Classes/BinaryFileDecoder.html @@ -0,0 +1,501 @@ + + + + BinaryFileDecoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryFileDecoder

    +
    +
    + +
    public final class BinaryFileDecoder<Element> where Element : Decodable
    + +
    +
    +

    Read elements from a binary file.

    + +

    The decoder allows reading individual elements from a file without loading all file data to memory all at once. +This decreases memory usage, which is especially useful for large files. +Elements can also be read all at once, and corrupted files can be read until the first decoding error occurs.

    + +

    The class internally uses BinaryStreamDecoder to encode the individual elements, +which can also be used independently to decode the data for more complex operations.

    + +

    Handling corrupted data

    + +

    The binary format does not necessarily allow detection of data corruption, and various errors can occur +as the result of added, changed, or missing bytes. Additional measures should be applied if there is an +increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key +followed by the length of the string in bytes, and the string content. The length of the string is encoded using +variable length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, +causing the decoder to wait for a very large number of bytes to decode the string. This simple error would cause much +data to be skipped. At the same time, it is not possible to determine with certainty where the error occured.

    + +

    The library does therefore only provide hints about the decoding errors likely occuring from non-conformance to the binary format +or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    +
    +

    Note

    + This class is compatible with BinaryFileEncoder and BinaryStreamEncoder, +but not with the outputs of BinaryEncoder. + +
    + +
    +
    +
    +
      +
    • +
      + + + + init(fileAt:decoder:) + +
      +
      +
      +
      +
      +
      +

      Create a file decoder.

      + +

      The given file is opened, and decoding will begin at the start of the file.

      +
      +

      Throws

      + An error, if the file handle could not be created. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(fileAt url: URL, decoder: BinaryDecoder = .init()) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + url + + +
      +

      The url of the file to read.

      +
      +
      + + decoder + + +
      +

      The decoder to use for decoding

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + close() + +
      +
      +
      +
      +
      +
      +

      Close the file.

      +
      +

      Note

      + After closing the file, the decoder can no longer read elements, which will result in an error or an exception. + +
      +

      Throws

      + Currently throws a ObjC-style Exception, not an Error, even on modern systems. +This is a bug in the Foundation framework. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func close() throws
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + + +
    + +

    Decoding +

    +
    +
    +
      +
    • +
      + + + + read(_:) + +
      +
      +
      +
      +
      +
      +

      Read all elements in the file, and handle each element using a closure.

      +
      +

      Throws

      + Decoding errors of type BinaryDecodingError. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func read(_ elementHandler: (Element) -> Void) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + elementHandler + + +
      +

      The closure to handle each element as it is decoded.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + readAll() + +
      +
      +
      +
      +
      +
      +

      Read all elements at once.

      +
      +

      Throws

      + Errors of type BinaryDecodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readAll() throws -> [Element]
      + +
      +
      +
      +

      Return Value

      +

      The elements decoded from the file.

      +
      +
      +
      +
    • +
    • +
      + + + + readAllUntilError() + +
      +
      +
      +
      +
      +
      +

      Read all elements at once, and ignore errors.

      + +

      This function reads elements until it reaches the end of the file or detects a decoding error. +Any data after the first error will be ignored.

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readAllUntilError() -> [Element]
      + +
      +
      +
      +

      Return Value

      +

      The elements successfully decoded from the file.

      +
      +
      +
      +
    • +
    • +
      + + + + readElement() + +
      +
      +
      +
      +
      +
      +

      Read a single elements from the current position in the file.

      +
      +

      Throws

      + Errors of type BinaryDecodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readElement() throws -> Element?
      + +
      +
      +
      +

      Return Value

      +

      The element decoded from the file, or nil, if no more data is available.

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/Classes/BinaryFileEncoder.html b/docs/Classes/BinaryFileEncoder.html new file mode 100644 index 0000000..05c2091 --- /dev/null +++ b/docs/Classes/BinaryFileEncoder.html @@ -0,0 +1,416 @@ + + + + BinaryFileEncoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryFileEncoder

    +
    +
    + +
    public final class BinaryFileEncoder<Element> where Element : Encodable
    + +
    +
    +

    Encode a stream of elements to a binary file.

    + +

    This class complements BinaryStreamEncoder to directly write encoded elements to a file.

    + +
    +
    +
    +
      +
    • +
      + + + + init(fileAt:encoder:) + +
      +
      +
      +
      +
      +
      +

      Create a new file encoder.

      +
      +

      Note

      + The file will be created, if it does not exist. +If it exists, then the new elements will be appended to the end of the file. + +
      +

      Throws

      + Throws an error if the file could not be accessed or created. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(fileAt url: URL, encoder: BinaryEncoder = .init()) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + url + + +
      +

      The url to the file.

      +
      +
      + + encoder + + +
      +

      The encoder to use for each element.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + close() + +
      +
      +
      +
      +
      +
      +

      Close the file.

      +
      +

      Note

      + After closing the file, the encoder can no longer write elements, which will result in an error or an exception. + +
      +

      Throws

      + Currently throws a ObjC-style Exception, not an Error, even on modern systems. +This is a bug in the Foundation framework. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func close() throws
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + write(_:) + +
      +
      +
      +
      +
      +
      +

      Write a single element to the file.

      +
      +

      Note

      + This function will throw an error or exception if the file handle has already been closed. + +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func write(_ element: Element) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + element + + +
      +

      The element to encode.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + write(contentsOf:) + +
      +
      +
      +
      +
      +
      +

      Write a sequence of elements to the file.

      + +

      This is a convenience function calling write(_ element:) for each element of the sequence in order.

      +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func write<S>(contentsOf sequence: S) throws where Element == S.Element, S : Sequence
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + sequence + + +
      +

      The sequence to encode

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/Classes/BinaryStreamDecoder.html b/docs/Classes/BinaryStreamDecoder.html new file mode 100644 index 0000000..3e6502a --- /dev/null +++ b/docs/Classes/BinaryStreamDecoder.html @@ -0,0 +1,348 @@ + + + + BinaryStreamDecoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryStreamDecoder

    +
    +
    + +
    public final class BinaryStreamDecoder<Element> where Element : Decodable
    + +
    +
    +

    Decode elements from a byte stream.

    + +

    Stream decoding can be used when either the data is not regularly available completely (e.g. when loading data over a network connection), +or when the binary data should not be loaded into memory all at once (e.g. when parsing a file).

    + +

    Each stream decoder handles only elements of a single type. +The elements are handed to a handler passed to the decoder upon initialization. +The byte stream is managed by a provider also specified on object creation. +The decoder can then attempt to read elements by reading bytes from the provider, until a complete element can be decoded. +Buffering is handled internally, freeing the stream provider from this responsibility. +Each completely decoded element is immediatelly passed to handler for further processing.

    + +
    +
    +
    +
      +
    • +
      + + + + init(decoder:) + +
      +
      +
      +
      +
      +
      +

      Create a stream decoder.

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(decoder: BinaryDecoder = .init())
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + decoder + + +
      +

      The decoder to use for decoding.

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + + +
    + +

    Decoding +

    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Read elements from the stream until no more bytes are available.

      +
      +

      Throws

      + Decoding errors of type BinaryDecodingError. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func decode(_ data: Data, returnElementsBeforeError: Bool = false) throws -> [Element]
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + returnElementsBeforeError + + +
      +

      If set to true, +then all successfully decoded elements will be returned if an error occurs. Defaults to false

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + decodeElement() + +
      +
      +
      +
      +
      +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func decodeElement() throws -> Element?
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/Classes/BinaryStreamEncoder.html b/docs/Classes/BinaryStreamEncoder.html new file mode 100644 index 0000000..c01c6d4 --- /dev/null +++ b/docs/Classes/BinaryStreamEncoder.html @@ -0,0 +1,405 @@ + + + + BinaryStreamEncoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryStreamEncoder

    +
    +
    + +
    public final class BinaryStreamEncoder<Element> where Element : Encodable
    + +
    +
    +

    Encode elements sequentially into a binary data stream.

    + +

    A stream encoder is used to encode individual elements of the same type to a continuous binary stream, +which can be decoded sequentially.

    + +

    The encoding behaviour is different to BinaryEncoder, where the full data must be present to successfully decode. +Additional information is embedded into the stream to facilitate this behaviour. +The binary data produced by a stream encoder is not compatible with BinaryDecoder and can only be decoded using +BinaryStreamDecoder.

    + +

    The special data format of an encoded stream also allows joining sequences of encoded data, where: +encode([a,b]) + encode([c,d]) == encode([a,b,c,d]) and decode(encode([a]) + encode([b])) == [a,b]

    + +

    Example:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let encoded1 = try encoder.encode(1)
    +
    +let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(encoded1)
    +print(decoded1) // [1]
    +
    +let encoded2 = try encoder.encode(contentsOf: [2,3])
    +let decoded2 = try decoder.decode(encoded2)
    +print(decoded2) // [2,3]
    +
    +
    +

    Note

    + Stream decoders always work on a single type, because no type information is encoded into the data. + +
    + +
    +
    +
    +
      +
    • +
      + + + + init(encoder:) + +
      +
      +
      +
      +
      +
      +

      Create a new stream encoder.

      +
      +

      Note

      + The encoder should never be reconfigured after being passed to this function, +to prevent decoding errors due to mismatching binary formats. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(encoder: BinaryEncoder = .init())
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + encoder + + +
      +

      The encoder to use for the individual elements.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + encode(_:) + +
      +
      +
      +
      +
      +
      +

      Encode an element for the data stream.

      + +

      Call this function to convert an element into binary data whenever new elements are available. +The data provided as the result of this function should be processed (e.g. stored or transmitted) while conserving the +order of the chunks, so that decoding can work reliably.

      + +

      Pass the encoded data back into an instance of BinaryStreamDecoder to convert each chunk back to an element.

      +
      +

      Note

      + Data encoded by this function can only be decoded by an appropriate BinaryStreamDecoder. +Decoding using a simple BinaryDecoder will not be successful. + +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func encode(_ element: Element) throws -> Data
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + element + + +
      +

      The element to encode.

      +
      +
      +
      +
      +

      Return Value

      +

      The next chunk of the encoded binary stream.

      +
      +
      +
      +
    • +
    • +
      + + + + encode(contentsOf:) + +
      +
      +
      +
      +
      +
      +

      Encode a sequence of elements.

      + +

      This function performs multiple calls to encode(_:) to convert all elements of the sequence, and then returns the joined data.

      +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func encode<S>(contentsOf sequence: S) throws -> Data where Element == S.Element, S : Sequence
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + sequence + + +
      +

      The sequence of elements to encode

      +
      +
      +
      +
      +

      Return Value

      +

      The binary data of the encoded sequence elements

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/Classes/ProtobufDecoder.html b/docs/Classes/ProtobufDecoder.html index 75c5545..21de297 100644 --- a/docs/Classes/ProtobufDecoder.html +++ b/docs/Classes/ProtobufDecoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -397,7 +409,7 @@

    Return Value

    diff --git a/docs/Classes/ProtobufEncoder.html b/docs/Classes/ProtobufEncoder.html index a1e4e87..f2d01ad 100644 --- a/docs/Classes/ProtobufEncoder.html +++ b/docs/Classes/ProtobufEncoder.html @@ -56,6 +56,18 @@ + + + + @@ -370,7 +382,7 @@

    Return Value

    diff --git a/docs/Enums.html b/docs/Enums.html index 8c6745c..4dd0b0d 100644 --- a/docs/Enums.html +++ b/docs/Enums.html @@ -56,6 +56,18 @@ + + + + @@ -317,7 +329,7 @@

    Declaration

    diff --git a/docs/Enums/BinaryDecodingError.html b/docs/Enums/BinaryDecodingError.html index e26fc71..39653e3 100644 --- a/docs/Enums/BinaryDecodingError.html +++ b/docs/Enums/BinaryDecodingError.html @@ -56,6 +56,18 @@ + + + + @@ -511,7 +523,7 @@

    Declaration

    diff --git a/docs/Enums/BinaryEncodingError.html b/docs/Enums/BinaryEncodingError.html index 5d4e692..4003b3b 100644 --- a/docs/Enums/BinaryEncodingError.html +++ b/docs/Enums/BinaryEncodingError.html @@ -56,6 +56,18 @@ + + + + @@ -309,7 +321,7 @@

    Declaration

    diff --git a/docs/Enums/DataType.html b/docs/Enums/DataType.html index db893b0..ae5dc21 100644 --- a/docs/Enums/DataType.html +++ b/docs/Enums/DataType.html @@ -56,6 +56,18 @@ + + + + @@ -376,7 +388,7 @@

    Declaration

    diff --git a/docs/Enums/ProtobufDecodingError.html b/docs/Enums/ProtobufDecodingError.html index 1a6d1ed..3eb2c13 100644 --- a/docs/Enums/ProtobufDecodingError.html +++ b/docs/Enums/ProtobufDecodingError.html @@ -56,6 +56,18 @@ + + + + @@ -291,7 +303,7 @@

    Declaration

    diff --git a/docs/Enums/ProtobufEncodingError.html b/docs/Enums/ProtobufEncodingError.html index 8d7037a..9728d2f 100644 --- a/docs/Enums/ProtobufEncodingError.html +++ b/docs/Enums/ProtobufEncodingError.html @@ -56,6 +56,18 @@ + + + + @@ -510,7 +522,7 @@

    Declaration

    diff --git a/docs/Extensions.html b/docs/Extensions.html index b3d01ea..60cee6c 100644 --- a/docs/Extensions.html +++ b/docs/Extensions.html @@ -56,6 +56,18 @@ + + + + @@ -557,7 +569,7 @@

    Declaration

    diff --git a/docs/Extensions/Int.html b/docs/Extensions/Int.html index b789f63..43c2842 100644 --- a/docs/Extensions/Int.html +++ b/docs/Extensions/Int.html @@ -56,6 +56,18 @@ + + + + @@ -311,7 +323,7 @@

    Declaration

    diff --git a/docs/Extensions/Int32.html b/docs/Extensions/Int32.html index b494db3..568795f 100644 --- a/docs/Extensions/Int32.html +++ b/docs/Extensions/Int32.html @@ -56,6 +56,18 @@ + + + + @@ -312,7 +324,7 @@

    Declaration

    diff --git a/docs/Extensions/Int64.html b/docs/Extensions/Int64.html index c57c15a..6f9156a 100644 --- a/docs/Extensions/Int64.html +++ b/docs/Extensions/Int64.html @@ -56,6 +56,18 @@ + + + + @@ -310,7 +322,7 @@

    Declaration

    diff --git a/docs/Extensions/UInt.html b/docs/Extensions/UInt.html index 4fd080b..3602809 100644 --- a/docs/Extensions/UInt.html +++ b/docs/Extensions/UInt.html @@ -56,6 +56,18 @@ + + + + @@ -283,7 +295,7 @@

    Declaration

    diff --git a/docs/Extensions/UInt32.html b/docs/Extensions/UInt32.html index ec3b53f..49abe3f 100644 --- a/docs/Extensions/UInt32.html +++ b/docs/Extensions/UInt32.html @@ -56,6 +56,18 @@ + + + + @@ -284,7 +296,7 @@

    Declaration

    diff --git a/docs/Extensions/UInt64.html b/docs/Extensions/UInt64.html index 7406f41..f3073e6 100644 --- a/docs/Extensions/UInt64.html +++ b/docs/Extensions/UInt64.html @@ -56,6 +56,18 @@ + + + + @@ -283,7 +295,7 @@

    Declaration

    diff --git a/docs/Guides.html b/docs/Guides.html index e7fd302..a248dbc 100644 --- a/docs/Guides.html +++ b/docs/Guides.html @@ -56,6 +56,18 @@ + + + + @@ -191,7 +203,7 @@

    Guides

    diff --git a/docs/Protocols.html b/docs/Protocols.html index 563600d..1a93793 100644 --- a/docs/Protocols.html +++ b/docs/Protocols.html @@ -56,6 +56,18 @@ + + + + @@ -285,7 +297,7 @@

    Declaration

    diff --git a/docs/Protocols/FixedSizeCompatible.html b/docs/Protocols/FixedSizeCompatible.html index 544b772..974b96a 100644 --- a/docs/Protocols/FixedSizeCompatible.html +++ b/docs/Protocols/FixedSizeCompatible.html @@ -56,6 +56,18 @@ + + + + @@ -312,7 +324,7 @@

    Parameters

    diff --git a/docs/Protocols/SignedValueCompatible.html b/docs/Protocols/SignedValueCompatible.html index c6d2857..b734e9c 100644 --- a/docs/Protocols/SignedValueCompatible.html +++ b/docs/Protocols/SignedValueCompatible.html @@ -56,6 +56,18 @@ + + + + @@ -206,7 +218,7 @@

    Declaration

    diff --git a/docs/Structs.html b/docs/Structs.html index 02213f9..663c4a1 100644 --- a/docs/Structs.html +++ b/docs/Structs.html @@ -56,6 +56,18 @@ + + + + @@ -292,7 +304,7 @@

    Declaration

    diff --git a/docs/Structs/FixedSize.html b/docs/Structs/FixedSize.html index 8d54880..9bae0b5 100644 --- a/docs/Structs/FixedSize.html +++ b/docs/Structs/FixedSize.html @@ -56,6 +56,18 @@ + + + + @@ -550,7 +562,7 @@

    Declaration

    diff --git a/docs/Structs/SignedValue.html b/docs/Structs/SignedValue.html index 2d68538..394dba0 100644 --- a/docs/Structs/SignedValue.html +++ b/docs/Structs/SignedValue.html @@ -56,6 +56,18 @@ + + + + @@ -561,7 +573,7 @@

    Declaration

    diff --git a/docs/binaryformat.html b/docs/binaryformat.html index c177263..e91c00c 100644 --- a/docs/binaryformat.html +++ b/docs/binaryformat.html @@ -55,6 +55,18 @@ + + + + @@ -163,7 +175,9 @@

    Binary data structure

    -

    Note: The BinaryCodable format is optimized for size, but does not go all-out to create the smallest binary sizes possible. If this is your goal, then simply using Codable with it’s key-value approach will not be the best solution. An unkeyed format optimized for the actually encoded data will be more suitable. But if you’re really looking into this kind of efficiency, then you probably know this already.

    +

    Note: The BinaryCodable format is optimized for size, but does not go all-out to create the smallest binary sizes possible. +The binary format, while being efficient, needs to serve as a general-purpose encoding, which will never be as efficient than a custom format optimized for a very specific use case. +If this is your goal, then simply using Codable with it’s key-value approach will not be the best solution. An unkeyed format optimized for the actually encoded data will be more suitable. But if you’re really looking into this kind of efficiency, then you probably know this already.

    The encoding format used by BinaryCodable is similar to Google’s Protocol Buffers in some aspects, but provides much more flexibility regarding the different types which can be encoded, including the ability to encode Optional, Set, single values, multidimensional Arrays, and more.

    Integer encoding

    @@ -188,7 +202,18 @@

    Arrays

    Arrays (and other sequences) are encoded by converting each item to binary data, and concatenating the results. Elements with variable length (like String) are prepended with their length encoded as a Varint. Each encoded array has at least one byte prepended to it, in order to support optional values.

    Arrays of Optionals

    -

    It is possible to encode arrays where the elements are Optional, e.g. [Bool?]. Due to constraints regarding Apple’s implementation of Encoder and Decoder, it is not consistently possible to infer if optionals are present in unkeyed containers. BinaryCodable therefore encodes optionals using a different strategy: Each array binary representation is prepended with a “nil index set”. It first consists of the number of nil elements in the sequence, encoded as a Varint. Then follow the indices in the array where nil values are present, each encoded as a Varint. The decoder can then first parse this nil set, and return the appropriate value for each position where a nil value is encoded. This approach is fairly efficient while only few nil values are encoded, or while the sequence doesn’t contain a large number of elements. For arrays that don’t contain optionals, only a single byte (0) is prepended to the binary representation, to signal that there are no nil indices in the sequence.

    +

    It is possible to encode arrays where the elements are Optional, e.g. [Bool?]. Due to constraints regarding Apple’s implementation of Encoder and Decoder, it is not consistently possible to infer if optionals are present in unkeyed containers. BinaryCodable therefore encodes optionals using a different strategy: Each array binary representation is prepended with a “nil index set”. It first consists of the number of nil elements in the sequence, encoded as a Varint. Then follow the indices in the array where nil values are present, each encoded as a Varint. The decoder can then first parse this nil set, and return the appropriate value for each position where a nil value is encoded. This approach is fairly efficient while only few nil values are encoded, or while the sequence doesn’t contain a large number of elements. +For arrays that don’t contain optionals, only a single byte (0) is prepended to the binary representation, to signal that there are no nil indices in the sequence.

    + +

    If the prependNilIndexSetForUnkeyedContainers is set to false, then this behaviour is changed. +The encoder then omits the nil index set, and instead adds a single byte 0x01 before each non-nil element, and a single 0x00 byte to signal nil.

    +
    +

    Note

    + One benefit of this option is that top-level sequences can be joined using their binary data, where encoded([a,b]) | encoded([c,d]) == encoded([a,b,c,d]). + +
    + +

    More efficient ways could be devised to handle arrays of optionals, like specifying the number of nil or non-nil elements following one another, but the increased encoding and decoding complexity don’t justify these gains in communication efficiency.

    Structs

    Structs are encoded using Codable‘s KeyedEncodingContainer, which uses String or Int coding keys to distinguish the properties of the types. @@ -449,11 +474,27 @@

    Dictionaries with Intege

    Dictionaries with String keys

    For dictionaries with String keys ([String: ...]), the process is similar to the above, except with CodingKeys having the stringValue of the key. There is another weird exception though: Whenever a String can be represented by an integer (i.e. when String(key) != nil), then the corresponding CodingKey will have its integerValue also set. This means that for dictionaries with integer keys, there may be a mixture of integer and string keys present in the binary data, depending on the input values. But don’t worry, BinaryCodable will also handle these cases correctly.

    +

    Stream encoding

    + +

    The encoding for data streams is only differs from standard encoding in two key aspects.

    +

    Added length information

    + +

    Each top-level element is encoded as if it is part of an unkeyed container (which it essentially is), meaning that each element has the necessary length information prepended to determine it’s size. +Only types with data type variable length have their length prepended using varint encoding. +This concerns String and Data, as well as complex types like structs and arrays, among others.

    +

    Optionals

    + +

    Normally, Optional values in unkeyed containers are tracked using nil index sets, which is prepended to the list of non-optionals. +This approach is not possible for streams, requiring additional information for each element in the stream. +A single byte is prepended to each Optional element, where binary 0x01 is used to indicate a non-optional value, and 0x00 is used to signal an optional value. +nil values have no additional data, so each is encoded using one byte.

    + +

    This encoding of optionals is similar to the encoding of sequences of optionals when not using the default option.

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes.html index 0f9fd13..192a742 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Classes.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes.html @@ -56,6 +56,18 @@ + + + + @@ -256,6 +268,187 @@

    Declaration

    +
  • +
    + + + + BinaryFileDecoder + +
    +
    +
    +
    +
    +
    +

    Read elements from a binary file.

    + +

    The decoder allows reading individual elements from a file without loading all file data to memory all at once. +This decreases memory usage, which is especially useful for large files. +Elements can also be read all at once, and corrupted files can be read until the first decoding error occurs.

    + +

    The class internally uses BinaryStreamDecoder to encode the individual elements, +which can also be used independently to decode the data for more complex operations.

    + +

    Handling corrupted data

    + +

    The binary format does not necessarily allow detection of data corruption, and various errors can occur +as the result of added, changed, or missing bytes. Additional measures should be applied if there is an +increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key +followed by the length of the string in bytes, and the string content. The length of the string is encoded using +variable length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, +causing the decoder to wait for a very large number of bytes to decode the string. This simple error would cause much +data to be skipped. At the same time, it is not possible to determine with certainty where the error occured.

    + +

    The library does therefore only provide hints about the decoding errors likely occuring from non-conformance to the binary format +or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    +
    +

    Note

    + This class is compatible with BinaryFileEncoder and BinaryStreamEncoder, +but not with the outputs of BinaryEncoder. + +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryFileDecoder<Element> where Element : Decodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryFileEncoder + +
    +
    +
    +
    +
    +
    +

    Encode a stream of elements to a binary file.

    + +

    This class complements BinaryStreamEncoder to directly write encoded elements to a file.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryFileEncoder<Element> where Element : Encodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryStreamDecoder + +
    +
    +
    +
    +
    +
    +

    Decode elements from a byte stream.

    + +

    Stream decoding can be used when either the data is not regularly available completely (e.g. when loading data over a network connection), +or when the binary data should not be loaded into memory all at once (e.g. when parsing a file).

    + +

    Each stream decoder handles only elements of a single type. +The elements are handed to a handler passed to the decoder upon initialization. +The byte stream is managed by a provider also specified on object creation. +The decoder can then attempt to read elements by reading bytes from the provider, until a complete element can be decoded. +Buffering is handled internally, freeing the stream provider from this responsibility. +Each completely decoded element is immediatelly passed to handler for further processing.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryStreamDecoder<Element> where Element : Decodable
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + BinaryStreamEncoder + +
    +
    +
    +
    +
    +
    +

    Encode elements sequentially into a binary data stream.

    + +

    A stream encoder is used to encode individual elements of the same type to a continuous binary stream, +which can be decoded sequentially.

    + +

    The encoding behaviour is different to BinaryEncoder, where the full data must be present to successfully decode. +Additional information is embedded into the stream to facilitate this behaviour. +The binary data produced by a stream encoder is not compatible with BinaryDecoder and can only be decoded using +BinaryStreamDecoder.

    + +

    The special data format of an encoded stream also allows joining sequences of encoded data, where: +encode([a,b]) + encode([c,d]) == encode([a,b,c,d]) and decode(encode([a]) + encode([b])) == [a,b]

    + +

    Example:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let encoded1 = try encoder.encode(1)
    +
    +let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(encoded1)
    +print(decoded1) // [1]
    +
    +let encoded2 = try encoder.encode(contentsOf: [2,3])
    +let decoded2 = try decoder.decode(encoded2)
    +print(decoded2) // [2,3]
    +
    +
    +

    Note

    + Stream decoders always work on a single type, because no type information is encoded into the data. + +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public final class BinaryStreamEncoder<Element> where Element : Encodable
    + +
    +
    +
    +
    +
  • @@ -355,7 +548,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryDecoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryDecoder.html index 37026f2..2ddd56c 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryDecoder.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryDecoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -224,6 +236,45 @@

    Declaration

    +
  • + +
    +
    +
    +
    +
    +

    Assumes that unkeyed containers are encoded using a set of indices for nil values.

    + +

    Refer to the prependNilIndexSetForUnkeyedContainers property of BinaryEncoder +for more information about the binary data format in both cases.

    +
    +

    Note

    + This option defaults to true + +
    +

    Note

    + To decode successfully, the encoder must use the same setting for prependNilIndexSetForUnkeyedContainers. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var containsNilIndexSetForUnkeyedContainers: Bool
    + +
    +
    +
    +
    +
  • @@ -395,7 +446,7 @@

    Return Value

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryEncoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryEncoder.html index 0f4c824..af37b2a 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryEncoder.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryEncoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -233,6 +245,53 @@

    Declaration

    +
  • + +
    +
    +
    +
    +
    +

    Add a set of indices for nil values in unkeyed containers.

    + +

    This option changes the encoding of unkeyed sequences like arrays with optional values.

    + +

    If this option is set to true, then the encoded binary data first contains a list of indexes for each position where nil is encoded. +After this data the remaining (non-nil) values are added. +If this option is false, then each value is prepended with a byte 1 for non-nil values, and a byte 0 for nil values.

    + +

    Using an index set is generally more efficient, expect for large sequences with many nil values. +An index set is encoded using first the number of elements, and then each element, all encoded as var-ints.

    + +

    One benefit of this option is that top-level sequences can be joined using their binary data, where encoded([a,b]) | encoded([c,d]) == encoded([a,b,c,d]).

    +
    +

    Note

    + This option defaults to true + +
    +

    Note

    + To decode successfully, the decoder must use the same setting for containsNilIndexSetForUnkeyedContainers. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var prependNilIndexSetForUnkeyedContainers: Bool
    + +
    +
    +
    +
    +
  • @@ -412,7 +471,7 @@

    Return Value

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileDecoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileDecoder.html new file mode 100644 index 0000000..850ebca --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileDecoder.html @@ -0,0 +1,501 @@ + + + + BinaryFileDecoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryFileDecoder

    +
    +
    + +
    public final class BinaryFileDecoder<Element> where Element : Decodable
    + +
    +
    +

    Read elements from a binary file.

    + +

    The decoder allows reading individual elements from a file without loading all file data to memory all at once. +This decreases memory usage, which is especially useful for large files. +Elements can also be read all at once, and corrupted files can be read until the first decoding error occurs.

    + +

    The class internally uses BinaryStreamDecoder to encode the individual elements, +which can also be used independently to decode the data for more complex operations.

    + +

    Handling corrupted data

    + +

    The binary format does not necessarily allow detection of data corruption, and various errors can occur +as the result of added, changed, or missing bytes. Additional measures should be applied if there is an +increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key +followed by the length of the string in bytes, and the string content. The length of the string is encoded using +variable length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, +causing the decoder to wait for a very large number of bytes to decode the string. This simple error would cause much +data to be skipped. At the same time, it is not possible to determine with certainty where the error occured.

    + +

    The library does therefore only provide hints about the decoding errors likely occuring from non-conformance to the binary format +or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    +
    +

    Note

    + This class is compatible with BinaryFileEncoder and BinaryStreamEncoder, +but not with the outputs of BinaryEncoder. + +
    + +
    +
    +
    +
      +
    • +
      + + + + init(fileAt:decoder:) + +
      +
      +
      +
      +
      +
      +

      Create a file decoder.

      + +

      The given file is opened, and decoding will begin at the start of the file.

      +
      +

      Throws

      + An error, if the file handle could not be created. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(fileAt url: URL, decoder: BinaryDecoder = .init()) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + url + + +
      +

      The url of the file to read.

      +
      +
      + + decoder + + +
      +

      The decoder to use for decoding

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + close() + +
      +
      +
      +
      +
      +
      +

      Close the file.

      +
      +

      Note

      + After closing the file, the decoder can no longer read elements, which will result in an error or an exception. + +
      +

      Throws

      + Currently throws a ObjC-style Exception, not an Error, even on modern systems. +This is a bug in the Foundation framework. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func close() throws
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + + +
    + +

    Decoding +

    +
    +
    +
      +
    • +
      + + + + read(_:) + +
      +
      +
      +
      +
      +
      +

      Read all elements in the file, and handle each element using a closure.

      +
      +

      Throws

      + Decoding errors of type BinaryDecodingError. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func read(_ elementHandler: (Element) -> Void) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + elementHandler + + +
      +

      The closure to handle each element as it is decoded.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + readAll() + +
      +
      +
      +
      +
      +
      +

      Read all elements at once.

      +
      +

      Throws

      + Errors of type BinaryDecodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readAll() throws -> [Element]
      + +
      +
      +
      +

      Return Value

      +

      The elements decoded from the file.

      +
      +
      +
      +
    • +
    • +
      + + + + readAllUntilError() + +
      +
      +
      +
      +
      +
      +

      Read all elements at once, and ignore errors.

      + +

      This function reads elements until it reaches the end of the file or detects a decoding error. +Any data after the first error will be ignored.

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readAllUntilError() -> [Element]
      + +
      +
      +
      +

      Return Value

      +

      The elements successfully decoded from the file.

      +
      +
      +
      +
    • +
    • +
      + + + + readElement() + +
      +
      +
      +
      +
      +
      +

      Read a single elements from the current position in the file.

      +
      +

      Throws

      + Errors of type BinaryDecodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func readElement() throws -> Element?
      + +
      +
      +
      +

      Return Value

      +

      The element decoded from the file, or nil, if no more data is available.

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileEncoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileEncoder.html new file mode 100644 index 0000000..05c2091 --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryFileEncoder.html @@ -0,0 +1,416 @@ + + + + BinaryFileEncoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryFileEncoder

    +
    +
    + +
    public final class BinaryFileEncoder<Element> where Element : Encodable
    + +
    +
    +

    Encode a stream of elements to a binary file.

    + +

    This class complements BinaryStreamEncoder to directly write encoded elements to a file.

    + +
    +
    +
    +
      +
    • +
      + + + + init(fileAt:encoder:) + +
      +
      +
      +
      +
      +
      +

      Create a new file encoder.

      +
      +

      Note

      + The file will be created, if it does not exist. +If it exists, then the new elements will be appended to the end of the file. + +
      +

      Throws

      + Throws an error if the file could not be accessed or created. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(fileAt url: URL, encoder: BinaryEncoder = .init()) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + url + + +
      +

      The url to the file.

      +
      +
      + + encoder + + +
      +

      The encoder to use for each element.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + close() + +
      +
      +
      +
      +
      +
      +

      Close the file.

      +
      +

      Note

      + After closing the file, the encoder can no longer write elements, which will result in an error or an exception. + +
      +

      Throws

      + Currently throws a ObjC-style Exception, not an Error, even on modern systems. +This is a bug in the Foundation framework. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func close() throws
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + write(_:) + +
      +
      +
      +
      +
      +
      +

      Write a single element to the file.

      +
      +

      Note

      + This function will throw an error or exception if the file handle has already been closed. + +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func write(_ element: Element) throws
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + element + + +
      +

      The element to encode.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + write(contentsOf:) + +
      +
      +
      +
      +
      +
      +

      Write a sequence of elements to the file.

      + +

      This is a convenience function calling write(_ element:) for each element of the sequence in order.

      +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func write<S>(contentsOf sequence: S) throws where Element == S.Element, S : Sequence
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + sequence + + +
      +

      The sequence to encode

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamDecoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamDecoder.html new file mode 100644 index 0000000..3e6502a --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamDecoder.html @@ -0,0 +1,348 @@ + + + + BinaryStreamDecoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryStreamDecoder

    +
    +
    + +
    public final class BinaryStreamDecoder<Element> where Element : Decodable
    + +
    +
    +

    Decode elements from a byte stream.

    + +

    Stream decoding can be used when either the data is not regularly available completely (e.g. when loading data over a network connection), +or when the binary data should not be loaded into memory all at once (e.g. when parsing a file).

    + +

    Each stream decoder handles only elements of a single type. +The elements are handed to a handler passed to the decoder upon initialization. +The byte stream is managed by a provider also specified on object creation. +The decoder can then attempt to read elements by reading bytes from the provider, until a complete element can be decoded. +Buffering is handled internally, freeing the stream provider from this responsibility. +Each completely decoded element is immediatelly passed to handler for further processing.

    + +
    +
    +
    +
      +
    • +
      + + + + init(decoder:) + +
      +
      +
      +
      +
      +
      +

      Create a stream decoder.

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(decoder: BinaryDecoder = .init())
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + decoder + + +
      +

      The decoder to use for decoding.

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + + +
    + +

    Decoding +

    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Read elements from the stream until no more bytes are available.

      +
      +

      Throws

      + Decoding errors of type BinaryDecodingError. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func decode(_ data: Data, returnElementsBeforeError: Bool = false) throws -> [Element]
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + returnElementsBeforeError + + +
      +

      If set to true, +then all successfully decoded elements will be returned if an error occurs. Defaults to false

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + decodeElement() + +
      +
      +
      +
      +
      +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func decodeElement() throws -> Element?
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamEncoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamEncoder.html new file mode 100644 index 0000000..c01c6d4 --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/BinaryStreamEncoder.html @@ -0,0 +1,405 @@ + + + + BinaryStreamEncoder Class Reference + + + + + + + + + + + + + +
    +
    +

    Docs (100% documented)

    +

    GitHubView on GitHub

    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    BinaryStreamEncoder

    +
    +
    + +
    public final class BinaryStreamEncoder<Element> where Element : Encodable
    + +
    +
    +

    Encode elements sequentially into a binary data stream.

    + +

    A stream encoder is used to encode individual elements of the same type to a continuous binary stream, +which can be decoded sequentially.

    + +

    The encoding behaviour is different to BinaryEncoder, where the full data must be present to successfully decode. +Additional information is embedded into the stream to facilitate this behaviour. +The binary data produced by a stream encoder is not compatible with BinaryDecoder and can only be decoded using +BinaryStreamDecoder.

    + +

    The special data format of an encoded stream also allows joining sequences of encoded data, where: +encode([a,b]) + encode([c,d]) == encode([a,b,c,d]) and decode(encode([a]) + encode([b])) == [a,b]

    + +

    Example:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let encoded1 = try encoder.encode(1)
    +
    +let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(encoded1)
    +print(decoded1) // [1]
    +
    +let encoded2 = try encoder.encode(contentsOf: [2,3])
    +let decoded2 = try decoder.decode(encoded2)
    +print(decoded2) // [2,3]
    +
    +
    +

    Note

    + Stream decoders always work on a single type, because no type information is encoded into the data. + +
    + +
    +
    +
    +
      +
    • +
      + + + + init(encoder:) + +
      +
      +
      +
      +
      +
      +

      Create a new stream encoder.

      +
      +

      Note

      + The encoder should never be reconfigured after being passed to this function, +to prevent decoding errors due to mismatching binary formats. + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public init(encoder: BinaryEncoder = .init())
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + encoder + + +
      +

      The encoder to use for the individual elements.

      +
      +
      +
      +
      +
      +
    • +
    • +
      + + + + encode(_:) + +
      +
      +
      +
      +
      +
      +

      Encode an element for the data stream.

      + +

      Call this function to convert an element into binary data whenever new elements are available. +The data provided as the result of this function should be processed (e.g. stored or transmitted) while conserving the +order of the chunks, so that decoding can work reliably.

      + +

      Pass the encoded data back into an instance of BinaryStreamDecoder to convert each chunk back to an element.

      +
      +

      Note

      + Data encoded by this function can only be decoded by an appropriate BinaryStreamDecoder. +Decoding using a simple BinaryDecoder will not be successful. + +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func encode(_ element: Element) throws -> Data
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + element + + +
      +

      The element to encode.

      +
      +
      +
      +
      +

      Return Value

      +

      The next chunk of the encoded binary stream.

      +
      +
      +
      +
    • +
    • +
      + + + + encode(contentsOf:) + +
      +
      +
      +
      +
      +
      +

      Encode a sequence of elements.

      + +

      This function performs multiple calls to encode(_:) to convert all elements of the sequence, and then returns the joined data.

      +
      +

      Throws

      + Errors of type BinaryEncodingError + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      public func encode<S>(contentsOf sequence: S) throws -> Data where Element == S.Element, S : Sequence
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + sequence + + +
      +

      The sequence of elements to encode

      +
      +
      +
      +
      +

      Return Value

      +

      The binary data of the encoded sequence elements

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufDecoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufDecoder.html index 75c5545..21de297 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufDecoder.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufDecoder.html @@ -56,6 +56,18 @@
  • + + + + @@ -397,7 +409,7 @@

    Return Value

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufEncoder.html b/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufEncoder.html index a1e4e87..f2d01ad 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufEncoder.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Classes/ProtobufEncoder.html @@ -56,6 +56,18 @@ + + + + @@ -370,7 +382,7 @@

    Return Value

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums.html index 8c6745c..4dd0b0d 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums.html @@ -56,6 +56,18 @@ + + + + @@ -317,7 +329,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryDecodingError.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryDecodingError.html index e26fc71..39653e3 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryDecodingError.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryDecodingError.html @@ -56,6 +56,18 @@ + + + + @@ -511,7 +523,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryEncodingError.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryEncodingError.html index 5d4e692..4003b3b 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryEncodingError.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums/BinaryEncodingError.html @@ -56,6 +56,18 @@ + + + + @@ -309,7 +321,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums/DataType.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums/DataType.html index db893b0..ae5dc21 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums/DataType.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums/DataType.html @@ -56,6 +56,18 @@ + + + + @@ -376,7 +388,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufDecodingError.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufDecodingError.html index 1a6d1ed..3eb2c13 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufDecodingError.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufDecodingError.html @@ -56,6 +56,18 @@ + + + + @@ -291,7 +303,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufEncodingError.html b/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufEncodingError.html index 8d7037a..9728d2f 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufEncodingError.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Enums/ProtobufEncodingError.html @@ -56,6 +56,18 @@ + + + + @@ -510,7 +522,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions.html index b3d01ea..60cee6c 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions.html @@ -56,6 +56,18 @@ + + + + @@ -557,7 +569,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int.html index b789f63..43c2842 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int.html @@ -56,6 +56,18 @@ + + + + @@ -311,7 +323,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int32.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int32.html index b494db3..568795f 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int32.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int32.html @@ -56,6 +56,18 @@ + + + + @@ -312,7 +324,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int64.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int64.html index c57c15a..6f9156a 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int64.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/Int64.html @@ -56,6 +56,18 @@ + + + + @@ -310,7 +322,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt.html index 4fd080b..3602809 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt.html @@ -56,6 +56,18 @@ + + + + @@ -283,7 +295,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt32.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt32.html index ec3b53f..49abe3f 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt32.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt32.html @@ -56,6 +56,18 @@ + + + + @@ -284,7 +296,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt64.html b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt64.html index 7406f41..f3073e6 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt64.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Extensions/UInt64.html @@ -56,6 +56,18 @@ + + + + @@ -283,7 +295,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Guides.html b/docs/docsets/.docset/Contents/Resources/Documents/Guides.html index e7fd302..a248dbc 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Guides.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Guides.html @@ -56,6 +56,18 @@ + + + + @@ -191,7 +203,7 @@

    Guides

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Protocols.html b/docs/docsets/.docset/Contents/Resources/Documents/Protocols.html index 563600d..1a93793 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Protocols.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Protocols.html @@ -56,6 +56,18 @@ + + + + @@ -285,7 +297,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Protocols/FixedSizeCompatible.html b/docs/docsets/.docset/Contents/Resources/Documents/Protocols/FixedSizeCompatible.html index 544b772..974b96a 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Protocols/FixedSizeCompatible.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Protocols/FixedSizeCompatible.html @@ -56,6 +56,18 @@ + + + + @@ -312,7 +324,7 @@

    Parameters

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Protocols/SignedValueCompatible.html b/docs/docsets/.docset/Contents/Resources/Documents/Protocols/SignedValueCompatible.html index c6d2857..b734e9c 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Protocols/SignedValueCompatible.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Protocols/SignedValueCompatible.html @@ -56,6 +56,18 @@ + + + + @@ -206,7 +218,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Structs.html b/docs/docsets/.docset/Contents/Resources/Documents/Structs.html index 02213f9..663c4a1 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Structs.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Structs.html @@ -56,6 +56,18 @@ + + + + @@ -292,7 +304,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Structs/FixedSize.html b/docs/docsets/.docset/Contents/Resources/Documents/Structs/FixedSize.html index 8d54880..9bae0b5 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Structs/FixedSize.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Structs/FixedSize.html @@ -56,6 +56,18 @@ + + + + @@ -550,7 +562,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/Structs/SignedValue.html b/docs/docsets/.docset/Contents/Resources/Documents/Structs/SignedValue.html index 2d68538..394dba0 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/Structs/SignedValue.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/Structs/SignedValue.html @@ -56,6 +56,18 @@ + + + + @@ -561,7 +573,7 @@

    Declaration

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/assets/logo.png b/docs/docsets/.docset/Contents/Resources/Documents/assets/logo.png new file mode 100644 index 0000000..9c6f100 Binary files /dev/null and b/docs/docsets/.docset/Contents/Resources/Documents/assets/logo.png differ diff --git a/docs/docsets/.docset/Contents/Resources/Documents/assets/platforms.svg b/docs/docsets/.docset/Contents/Resources/Documents/assets/platforms.svg new file mode 100644 index 0000000..405ea78 --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/assets/platforms.svg @@ -0,0 +1 @@ +platformsplatformsiOS | macOS | Linux | tvOS | watchOSiOS | macOS | Linux | tvOS | watchOS \ No newline at end of file diff --git a/docs/docsets/.docset/Contents/Resources/Documents/assets/swift.svg b/docs/docsets/.docset/Contents/Resources/Documents/assets/swift.svg new file mode 100644 index 0000000..c60e0cb --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/assets/swift.svg @@ -0,0 +1 @@ +SwiftSwift5.65.6 \ No newline at end of file diff --git a/docs/docsets/.docset/Contents/Resources/Documents/badge.svg b/docs/docsets/.docset/Contents/Resources/Documents/badge.svg new file mode 100644 index 0000000..a096fec --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/badge.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + documentation + + + documentation + + + 100% + + + 100% + + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/binaryformat.html b/docs/docsets/.docset/Contents/Resources/Documents/binaryformat.html index c177263..e91c00c 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/binaryformat.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/binaryformat.html @@ -55,6 +55,18 @@ + + + + @@ -163,7 +175,9 @@

    Binary data structure

    -

    Note: The BinaryCodable format is optimized for size, but does not go all-out to create the smallest binary sizes possible. If this is your goal, then simply using Codable with it’s key-value approach will not be the best solution. An unkeyed format optimized for the actually encoded data will be more suitable. But if you’re really looking into this kind of efficiency, then you probably know this already.

    +

    Note: The BinaryCodable format is optimized for size, but does not go all-out to create the smallest binary sizes possible. +The binary format, while being efficient, needs to serve as a general-purpose encoding, which will never be as efficient than a custom format optimized for a very specific use case. +If this is your goal, then simply using Codable with it’s key-value approach will not be the best solution. An unkeyed format optimized for the actually encoded data will be more suitable. But if you’re really looking into this kind of efficiency, then you probably know this already.

    The encoding format used by BinaryCodable is similar to Google’s Protocol Buffers in some aspects, but provides much more flexibility regarding the different types which can be encoded, including the ability to encode Optional, Set, single values, multidimensional Arrays, and more.

    Integer encoding

    @@ -188,7 +202,18 @@

    Arrays

    Arrays (and other sequences) are encoded by converting each item to binary data, and concatenating the results. Elements with variable length (like String) are prepended with their length encoded as a Varint. Each encoded array has at least one byte prepended to it, in order to support optional values.

    Arrays of Optionals

    -

    It is possible to encode arrays where the elements are Optional, e.g. [Bool?]. Due to constraints regarding Apple’s implementation of Encoder and Decoder, it is not consistently possible to infer if optionals are present in unkeyed containers. BinaryCodable therefore encodes optionals using a different strategy: Each array binary representation is prepended with a “nil index set”. It first consists of the number of nil elements in the sequence, encoded as a Varint. Then follow the indices in the array where nil values are present, each encoded as a Varint. The decoder can then first parse this nil set, and return the appropriate value for each position where a nil value is encoded. This approach is fairly efficient while only few nil values are encoded, or while the sequence doesn’t contain a large number of elements. For arrays that don’t contain optionals, only a single byte (0) is prepended to the binary representation, to signal that there are no nil indices in the sequence.

    +

    It is possible to encode arrays where the elements are Optional, e.g. [Bool?]. Due to constraints regarding Apple’s implementation of Encoder and Decoder, it is not consistently possible to infer if optionals are present in unkeyed containers. BinaryCodable therefore encodes optionals using a different strategy: Each array binary representation is prepended with a “nil index set”. It first consists of the number of nil elements in the sequence, encoded as a Varint. Then follow the indices in the array where nil values are present, each encoded as a Varint. The decoder can then first parse this nil set, and return the appropriate value for each position where a nil value is encoded. This approach is fairly efficient while only few nil values are encoded, or while the sequence doesn’t contain a large number of elements. +For arrays that don’t contain optionals, only a single byte (0) is prepended to the binary representation, to signal that there are no nil indices in the sequence.

    + +

    If the prependNilIndexSetForUnkeyedContainers is set to false, then this behaviour is changed. +The encoder then omits the nil index set, and instead adds a single byte 0x01 before each non-nil element, and a single 0x00 byte to signal nil.

    +
    +

    Note

    + One benefit of this option is that top-level sequences can be joined using their binary data, where encoded([a,b]) | encoded([c,d]) == encoded([a,b,c,d]). + +
    + +

    More efficient ways could be devised to handle arrays of optionals, like specifying the number of nil or non-nil elements following one another, but the increased encoding and decoding complexity don’t justify these gains in communication efficiency.

    Structs

    Structs are encoded using Codable‘s KeyedEncodingContainer, which uses String or Int coding keys to distinguish the properties of the types. @@ -449,11 +474,27 @@

    Dictionaries with Intege

    Dictionaries with String keys

    For dictionaries with String keys ([String: ...]), the process is similar to the above, except with CodingKeys having the stringValue of the key. There is another weird exception though: Whenever a String can be represented by an integer (i.e. when String(key) != nil), then the corresponding CodingKey will have its integerValue also set. This means that for dictionaries with integer keys, there may be a mixture of integer and string keys present in the binary data, depending on the input values. But don’t worry, BinaryCodable will also handle these cases correctly.

    +

    Stream encoding

    + +

    The encoding for data streams is only differs from standard encoding in two key aspects.

    +

    Added length information

    + +

    Each top-level element is encoded as if it is part of an unkeyed container (which it essentially is), meaning that each element has the necessary length information prepended to determine it’s size. +Only types with data type variable length have their length prepended using varint encoding. +This concerns String and Data, as well as complex types like structs and arrays, among others.

    +

    Optionals

    + +

    Normally, Optional values in unkeyed containers are tracked using nil index sets, which is prepended to the list of non-optionals. +This approach is not possible for streams, requiring additional information for each element in the stream. +A single byte is prepended to each Optional element, where binary 0x01 is used to indicate a non-optional value, and 0x00 is used to signal an optional value. +nil values have no additional data, so each is encoded using one byte.

    + +

    This encoding of optionals is similar to the encoding of sequences of optionals when not using the default option.

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/docs/badge.svg b/docs/docsets/.docset/Contents/Resources/Documents/docs/badge.svg new file mode 100644 index 0000000..a096fec --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/docs/badge.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + documentation + + + documentation + + + 100% + + + 100% + + + diff --git a/docs/docsets/.docset/Contents/Resources/Documents/index.html b/docs/docsets/.docset/Contents/Resources/Documents/index.html index 45e6822..e1fcbe4 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/index.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/index.html @@ -55,6 +55,18 @@ + + + + @@ -171,7 +183,7 @@ - +

    @@ -247,6 +259,17 @@

    Errors

    All possible errors occuring during encoding produce BinaryEncodingError errors, while unsuccessful decoding produces BinaryDecodingErrors. Both are enums with several cases describing the nature of the error. See the documentation of the types to learn more about the different error conditions.

    +

    Handling corrupted data

    + +

    The binary format provides no provisions to detect data corruption, and various errors can occur as the result of added, changed, or missing bytes and bits. +Additional external measures (checksums, error-correcting codes, …) should be applied if there is an increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key followed by the length of the string in bytes, and the string content. +The length of the string is encoded using variable-length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, causing the decoder to wait for a very large number of bytes to decode the string. +This simple error would cause much data to be skipped, potentially corrupting the data stream indefinitely. +At the same time, it is not possible to determine with certainty where the error occured, making error recovery difficult without additional information about boundaries between elements.

    + +

    The decoding errors provided by the library are therefore only hints about error likely occuring from non-conformance to the binary format or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    Coding Keys

    The Codable protocol uses CodingKey definitions to identify properties of instances. By default, coding keys are generated using the string values of the property names.

    @@ -303,12 +326,71 @@

    Fixed size integers

    There is an additional SignedValue wrapper, which is only useful when encoding in protobuf-compatible format.

    Options

    +

    Sorting keys

    The BinaryEncoder provides the sortKeysDuringEncoding option, which forces fields in “keyed” containers, such as struct properties (and some dictionaries), to be sorted in the binary data. This sorting is done by using either the integer keys (if defined), or the property names. Dictionaries with Int or String keys are also sorted.

    Sorting the binary data does not influence decoding, but introduces a computation penalty during encoding. It should therefore only be used if the binary data must be consistent across multiple invocations.

    -

    Note: The sortKeysDuringEncoding option does not guarantee deterministic binary data, and should be used with care.

    +

    Note: The sortKeysDuringEncoding option does not neccessarily guarantee deterministic binary data, and should be used with care.

    +

    Encoding optionals in arrays

    + +

    Sequences of Optional values (like arrays, sets, …) are normally encoded using a nil index set. +The index of each nil element in the sequence is recorded, and only non-nil values are encoded. +The indices of nil elements are then prepended to the data as an array of integers. +During decoding, this index set is checked to place nil values between the non-nil elements at the appropriate indices.

    + +

    This encoding scheme is usually more efficient than, e.g. indicating for each element whether the value is non-optional using an additional byte. +There can be specific cases where nil index sets become less efficient, e.g. when storing very large arrays of mostly nil values.

    + +

    In these cases, the encoder option prependNilIndexSetForUnkeyedContainers can be set to false, causing the encoder to omit the nil index set in favour of an additional byte before each element. +The decoder must then have containsNilIndexSetForUnkeyedContainers set to false, so that the data can be successfully decoded.

    +

    Stream encoding and decoding

    + +

    The library provides the option to perform encoding and decoding of continuous streams, such as when writing sequences of elements to a file, or when transmitting data over a network. +This functionality can be used through BinaryStreamEncoder and BinaryStreamDecoder, causing the encoder to embed additional information into the data to allow continuous decoding (mostly length information). +Encoding and decoding is always done with sequences of one specific type, since multiple types in one stream could not be distinguished from one another.

    + +

    Encoding of a stream works similarly to normal encoding:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let chunk1 = try encoder.encode(1)
    +let chunk2 = try encoder.encode(contentsOf: [2,3])
    +...
    +
    +let data = chunk1 + chunk2 + ...
    +
    + +

    Decoding of the individual chunks, with the decoder returning all elements which can be decoded using the currently available data.

    +
    let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(chunk1)
    +print(decoded1) // [1]
    +
    +let decoded2 = try decoder.decode(chunk2)
    +print(decoded2) // [2,3]
    +
    + +

    The decoder has an internal buffer, so incomplete data can be inserted into the decoder as it becomes available. The output of decode(_ data:) will be empty until the next complete element is processed.

    +

    File encoding and decoding

    + +

    Writing data streams to files is a common use case, so the library also provides wrappers around BinaryStreamEncoder and BinaryStreamDecoder to perform these tasks. +The BinaryFileEncoder can be used to sequentially write elements to a file:

    +
    let encoder = BinaryFileEncoder<DataElement>(fileAt: url)
    +try encoder.write(element1)
    +try encoder.write(element2)
    +...
    +try encoder.close() // Close the file
    +
    + +

    Elements will always be appended to the end of file, so existing files can be updated with additional data.

    + +

    Decoding works in a similar way, except with a callback to handle each element as it is decoded:

    +
    let decoder = BinaryFileDecoder<DataElement>(fileAt: url)
    +try decoder.read { element in
    +    // Process each element
    +}
    +
    + +

    There is also the possibility to read all elements at once using readAll(), or to read only one element at a time (readElement()).

    Protocol Buffer compatibility

    Achieving Protocol Buffer compatibility is described in ProtobufSupport.md.

    @@ -345,7 +427,7 @@

    Documentation

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/protobufsupport.html b/docs/docsets/.docset/Contents/Resources/Documents/protobufsupport.html index eccff2c..be53141 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/protobufsupport.html +++ b/docs/docsets/.docset/Contents/Resources/Documents/protobufsupport.html @@ -55,6 +55,18 @@ + + + + @@ -499,7 +511,7 @@

    Oneof

    diff --git a/docs/docsets/.docset/Contents/Resources/Documents/search.json b/docs/docsets/.docset/Contents/Resources/Documents/search.json index 0d23867..a00a4ab 100644 --- a/docs/docsets/.docset/Contents/Resources/Documents/search.json +++ b/docs/docsets/.docset/Contents/Resources/Documents/search.json @@ -1 +1 @@ -{"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0xvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0ACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValueACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html":{"name":"FixedSize","abstract":"

    A wrapper for integer values which ensures that values are encoded in binary format using a fixed size.

    "},"Structs/SignedValue.html":{"name":"SignedValue","abstract":"

    A wrapper for integers more efficient for negative values.

    "},"Protocols/SignedValueCompatible.html#/s:13BinaryCodable21SignedValueCompatibleP17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"SignedValueCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","abstract":"

    The wire type of the type, which has a constant length

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","abstract":"

    The protobuf type equivalent to the fixed size type

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","abstract":"

    The value encoded as fixed size binary data

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","abstract":"

    Decode the value from binary data.

    ","parent_name":"FixedSizeCompatible"},"Protocols.html#/s:13BinaryCodable13ProtobufOneOfP":{"name":"ProtobufOneOf","abstract":"

    Add conformance to this protocol to enums which should be encoded as Protobuf Oneof values.

    "},"Protocols/FixedSizeCompatible.html":{"name":"FixedSizeCompatible","abstract":"

    An integer type which can be forced to use a fixed-length encoding instead of variable-length encoding.

    "},"Protocols/SignedValueCompatible.html":{"name":"SignedValueCompatible","abstract":"

    A signed integer which can be forced to use zig-zag encoding.

    "},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt64"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt32"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int64"},"Extensions/Int64.html#/s:s5Int64V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int64"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int32"},"Extensions/Int32.html#/s:s5Int32V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int32"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int"},"Extensions/Int.html#/s:Si13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int"},"Extensions.html#/s:13BinaryCodable11DecodingKeyO":{"name":"DecodingKey"},"Extensions.html#/s:13BinaryCodable21MixedCodingKeyWrapperV":{"name":"MixedCodingKeyWrapper"},"Extensions.html#/s:13BinaryCodable15ProtoKeyWrapperV":{"name":"ProtoKeyWrapper"},"Extensions.html#/s:13BinaryCodable13IntKeyWrapperV":{"name":"IntKeyWrapper"},"Extensions.html#/s:Sb":{"name":"Bool"},"Extensions.html#/s:10Foundation4DataV":{"name":"Data"},"Extensions.html#/s:Sf":{"name":"Float"},"Extensions/Int.html":{"name":"Int"},"Extensions/Int32.html":{"name":"Int32"},"Extensions/Int64.html":{"name":"Int64"},"Extensions.html#/s:SS":{"name":"String"},"Extensions/UInt.html":{"name":"UInt"},"Extensions/UInt32.html":{"name":"UInt32"},"Extensions/UInt64.html":{"name":"UInt64"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO015noValueInSingleG9ContaineryA2CmF":{"name":"noValueInSingleValueContainer","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO21nilValuesNotSupportedyA2CmF":{"name":"nilValuesNotSupported","abstract":"

    The encoded type contains optional values, which are not supported in the protocol buffer format.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17missingIntegerKeyyACSScACmF":{"name":"missingIntegerKey(_:)","abstract":"

    The encoded type contains properties which don’t have an integer key.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO31multipleTypesInUnkeyedContaineryA2CmF":{"name":"multipleTypesInUnkeyedContainer","abstract":"

    All values in unkeyed containers must have the same type.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20integerKeyOutOfRangeyACSicACmF":{"name":"integerKeyOutOfRange(_:)","abstract":"

    Field numbers must be positive integers not greater than 536870911 (2^29-1, or 0x1FFFFFFF)

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO26multipleContainersAccessedyA2CmF":{"name":"multipleContainersAccessed","abstract":"

    Multiple calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20noContainersAccessedyA2CmF":{"name":"noContainersAccessed","abstract":"

    No calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO23rootIsNotKeyedContaineryA2CmF":{"name":"rootIsNotKeyedContainer","abstract":"

    Protobuf requires an unkeyed container as the root node

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    An unavailable encoding feature was accessed.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO29protobufDefinitionUnavailableyACSScACmF":{"name":"protobufDefinitionUnavailable(_:)","parent_name":"ProtobufEncodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO23unexpectedDictionaryKeyyA2CmF":{"name":"unexpectedDictionaryKey","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    A decoding feature was accessed which is not supported for protobuf encoding.

    ","parent_name":"ProtobufDecodingError"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO21variableLengthIntegeryA2CmF":{"name":"variableLengthInteger","abstract":"

    An integer value encoded as a Base128 Varint.","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO4byteyA2CmF":{"name":"byte","abstract":"

    The value is encoded as a single byte.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO8twoBytesyA2CmF":{"name":"twoBytes","abstract":"

    The value is encoded as two bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO14variableLengthyA2CmF":{"name":"variableLength","abstract":"

    The value is encoded using first a length (as a UInt64 var-int) followed by the bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO9fourBytesyA2CmF":{"name":"fourBytes","abstract":"

    The value is encoded using four bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO10eightBytesyA2CmF":{"name":"eightBytes","abstract":"

    The value is encoded using eight bytes.

    ","parent_name":"DataType"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO06stringC6FailedyACSScACmF":{"name":"stringEncodingFailed(_:)","abstract":"

    A string could not be encoded to UTF-8.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO36multipleValuesInSingleValueContaineryA2CmF":{"name":"multipleValuesInSingleValueContainer","abstract":"

    A procedural error occuring during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO12invalidValueyACyp_s0cD0O7ContextVtcACmF":{"name":"invalidValue(_:_:)","abstract":"

    An indication that an encoder or its containers could not encode the given value.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15invalidDataSizeyA2CmF":{"name":"invalidDataSize","abstract":"

    The data for a primitive type did not have the right size.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO17missingDataForKeyyACs06CodingH0_pcACmF":{"name":"missingDataForKey(_:)","abstract":"

    The binary data is missing for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15unknownDataTypeyACSicACmF":{"name":"unknownDataType(_:)","abstract":"

    The binary data contained an unknown data type.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO18prematureEndOfDatayA2CmF":{"name":"prematureEndOfData","abstract":"

    The binary data ended before all values were decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13invalidStringyA2CmF":{"name":"invalidString","abstract":"

    A String contained in the data could not be decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO38variableLengthEncodedIntegerOutOfRangeyA2CmF":{"name":"variableLengthEncodedIntegerOutOfRange","abstract":"

    An integer encoded in the binary data as a varint does not fit into the specified integer type, producing an overflow.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO20multipleValuesForKeyyA2CmF":{"name":"multipleValuesForKey","abstract":"

    The binary data contains multiple values for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13dataCorruptedyACs0cD0O7ContextVcACmF":{"name":"dataCorrupted(_:)","abstract":"

    An indication that the data is corrupted or otherwise invalid.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO12typeMismatchyACypXp_s0cD0O7ContextVtcACmF":{"name":"typeMismatch(_:_:)","abstract":"

    An indication that a value of the given type could not be decoded because it did not match the type of what was found in the encoded payload.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13valueNotFoundyACypXp_s0cD0O7ContextVtcACmF":{"name":"valueNotFound(_:_:)","abstract":"

    An indication that a non-optional value of the given type was expected, but a null value was found.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during decoding.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html":{"name":"BinaryDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/BinaryEncodingError.html":{"name":"BinaryEncodingError","abstract":"

    An error thrown when encoding a value using BinaryEncoder.

    "},"Enums/DataType.html":{"name":"DataType","abstract":"

    The data type specifying how a value is encoded on the wire.

    "},"Enums/ProtobufDecodingError.html":{"name":"ProtobufDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/ProtobufEncodingError.html":{"name":"ProtobufEncodingError","abstract":"

    An error thrown when encoding a value using ProtobufEncoder.

    "},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"ProtobufDecoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC22sortKeysDuringEncodingSbvp":{"name":"sortKeysDuringEncoding","abstract":"

    Sort keyed data in the binary representation.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html":{"name":"BinaryDecoder","abstract":"

    An encoder to convert binary data back to Codable objects.

    "},"Classes/BinaryEncoder.html":{"name":"BinaryEncoder","abstract":"

    An encoder to convert Codable objects to binary data.

    "},"Classes/ProtobufDecoder.html":{"name":"ProtobufDecoder","abstract":"

    An encoder to convert protobuf binary data back to Codable objects.

    "},"Classes/ProtobufEncoder.html":{"name":"ProtobufEncoder","abstract":"

    An encoder to convert Codable objects to protobuf binary data.

    "},"binaryformat.html":{"name":"BinaryFormat"},"protobufsupport.html":{"name":"ProtobufSupport"},"Guides.html":{"name":"Guides","abstract":"

    The following guides are available globally.

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Enums.html":{"name":"Enumerations","abstract":"

    The following enumerations are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "}} \ No newline at end of file +{"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0xvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0ACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValueACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html":{"name":"FixedSize","abstract":"

    A wrapper for integer values which ensures that values are encoded in binary format using a fixed size.

    "},"Structs/SignedValue.html":{"name":"SignedValue","abstract":"

    A wrapper for integers more efficient for negative values.

    "},"Protocols/SignedValueCompatible.html#/s:13BinaryCodable21SignedValueCompatibleP17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"SignedValueCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","abstract":"

    The wire type of the type, which has a constant length

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","abstract":"

    The protobuf type equivalent to the fixed size type

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","abstract":"

    The value encoded as fixed size binary data

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","abstract":"

    Decode the value from binary data.

    ","parent_name":"FixedSizeCompatible"},"Protocols.html#/s:13BinaryCodable13ProtobufOneOfP":{"name":"ProtobufOneOf","abstract":"

    Add conformance to this protocol to enums which should be encoded as Protobuf Oneof values.

    "},"Protocols/FixedSizeCompatible.html":{"name":"FixedSizeCompatible","abstract":"

    An integer type which can be forced to use a fixed-length encoding instead of variable-length encoding.

    "},"Protocols/SignedValueCompatible.html":{"name":"SignedValueCompatible","abstract":"

    A signed integer which can be forced to use zig-zag encoding.

    "},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt64"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt32"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int64"},"Extensions/Int64.html#/s:s5Int64V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int64"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int32"},"Extensions/Int32.html#/s:s5Int32V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int32"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int"},"Extensions/Int.html#/s:Si13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int"},"Extensions.html#/s:13BinaryCodable11DecodingKeyO":{"name":"DecodingKey"},"Extensions.html#/s:13BinaryCodable21MixedCodingKeyWrapperV":{"name":"MixedCodingKeyWrapper"},"Extensions.html#/s:13BinaryCodable15ProtoKeyWrapperV":{"name":"ProtoKeyWrapper"},"Extensions.html#/s:13BinaryCodable13IntKeyWrapperV":{"name":"IntKeyWrapper"},"Extensions.html#/s:Sb":{"name":"Bool"},"Extensions.html#/s:10Foundation4DataV":{"name":"Data"},"Extensions.html#/s:Sf":{"name":"Float"},"Extensions/Int.html":{"name":"Int"},"Extensions/Int32.html":{"name":"Int32"},"Extensions/Int64.html":{"name":"Int64"},"Extensions.html#/s:SS":{"name":"String"},"Extensions/UInt.html":{"name":"UInt"},"Extensions/UInt32.html":{"name":"UInt32"},"Extensions/UInt64.html":{"name":"UInt64"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO015noValueInSingleG9ContaineryA2CmF":{"name":"noValueInSingleValueContainer","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO21nilValuesNotSupportedyA2CmF":{"name":"nilValuesNotSupported","abstract":"

    The encoded type contains optional values, which are not supported in the protocol buffer format.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17missingIntegerKeyyACSScACmF":{"name":"missingIntegerKey(_:)","abstract":"

    The encoded type contains properties which don’t have an integer key.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO31multipleTypesInUnkeyedContaineryA2CmF":{"name":"multipleTypesInUnkeyedContainer","abstract":"

    All values in unkeyed containers must have the same type.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20integerKeyOutOfRangeyACSicACmF":{"name":"integerKeyOutOfRange(_:)","abstract":"

    Field numbers must be positive integers not greater than 536870911 (2^29-1, or 0x1FFFFFFF)

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO26multipleContainersAccessedyA2CmF":{"name":"multipleContainersAccessed","abstract":"

    Multiple calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20noContainersAccessedyA2CmF":{"name":"noContainersAccessed","abstract":"

    No calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO23rootIsNotKeyedContaineryA2CmF":{"name":"rootIsNotKeyedContainer","abstract":"

    Protobuf requires an unkeyed container as the root node

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    An unavailable encoding feature was accessed.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO29protobufDefinitionUnavailableyACSScACmF":{"name":"protobufDefinitionUnavailable(_:)","parent_name":"ProtobufEncodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO23unexpectedDictionaryKeyyA2CmF":{"name":"unexpectedDictionaryKey","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    A decoding feature was accessed which is not supported for protobuf encoding.

    ","parent_name":"ProtobufDecodingError"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO21variableLengthIntegeryA2CmF":{"name":"variableLengthInteger","abstract":"

    An integer value encoded as a Base128 Varint.","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO4byteyA2CmF":{"name":"byte","abstract":"

    The value is encoded as a single byte.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO8twoBytesyA2CmF":{"name":"twoBytes","abstract":"

    The value is encoded as two bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO14variableLengthyA2CmF":{"name":"variableLength","abstract":"

    The value is encoded using first a length (as a UInt64 var-int) followed by the bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO9fourBytesyA2CmF":{"name":"fourBytes","abstract":"

    The value is encoded using four bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO10eightBytesyA2CmF":{"name":"eightBytes","abstract":"

    The value is encoded using eight bytes.

    ","parent_name":"DataType"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO06stringC6FailedyACSScACmF":{"name":"stringEncodingFailed(_:)","abstract":"

    A string could not be encoded to UTF-8.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO36multipleValuesInSingleValueContaineryA2CmF":{"name":"multipleValuesInSingleValueContainer","abstract":"

    A procedural error occuring during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO12invalidValueyACyp_s0cD0O7ContextVtcACmF":{"name":"invalidValue(_:_:)","abstract":"

    An indication that an encoder or its containers could not encode the given value.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15invalidDataSizeyA2CmF":{"name":"invalidDataSize","abstract":"

    The data for a primitive type did not have the right size.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO17missingDataForKeyyACs06CodingH0_pcACmF":{"name":"missingDataForKey(_:)","abstract":"

    The binary data is missing for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15unknownDataTypeyACSicACmF":{"name":"unknownDataType(_:)","abstract":"

    The binary data contained an unknown data type.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO18prematureEndOfDatayA2CmF":{"name":"prematureEndOfData","abstract":"

    The binary data ended before all values were decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13invalidStringyA2CmF":{"name":"invalidString","abstract":"

    A String contained in the data could not be decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO38variableLengthEncodedIntegerOutOfRangeyA2CmF":{"name":"variableLengthEncodedIntegerOutOfRange","abstract":"

    An integer encoded in the binary data as a varint does not fit into the specified integer type, producing an overflow.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO20multipleValuesForKeyyA2CmF":{"name":"multipleValuesForKey","abstract":"

    The binary data contains multiple values for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13dataCorruptedyACs0cD0O7ContextVcACmF":{"name":"dataCorrupted(_:)","abstract":"

    An indication that the data is corrupted or otherwise invalid.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO12typeMismatchyACypXp_s0cD0O7ContextVtcACmF":{"name":"typeMismatch(_:_:)","abstract":"

    An indication that a value of the given type could not be decoded because it did not match the type of what was found in the encoded payload.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13valueNotFoundyACypXp_s0cD0O7ContextVtcACmF":{"name":"valueNotFound(_:_:)","abstract":"

    An indication that a non-optional value of the given type was expected, but a null value was found.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during decoding.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html":{"name":"BinaryDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/BinaryEncodingError.html":{"name":"BinaryEncodingError","abstract":"

    An error thrown when encoding a value using BinaryEncoder.

    "},"Enums/DataType.html":{"name":"DataType","abstract":"

    The data type specifying how a value is encoded on the wire.

    "},"Enums/ProtobufDecodingError.html":{"name":"ProtobufDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/ProtobufEncodingError.html":{"name":"ProtobufEncodingError","abstract":"

    An error thrown when encoding a value using ProtobufEncoder.

    "},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"ProtobufDecoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC7encoderACyxGAA0aD0C_tcfc":{"name":"init(encoder:)","abstract":"

    Create a new stream encoder.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC6encodey10Foundation4DataVxKF":{"name":"encode(_:)","abstract":"

    Encode an element for the data stream.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC6encode10contentsOf10Foundation4DataVqd___tK7ElementQyd__RszSTRd__lF":{"name":"encode(contentsOf:)","abstract":"

    Encode a sequence of elements.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC7decoderACyxGAA0aD0C_tcfc":{"name":"init(decoder:)","abstract":"

    Create a stream decoder.

    ","parent_name":"BinaryStreamDecoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC6decode_25returnElementsBeforeErrorSayxG10Foundation4DataV_SbtKF":{"name":"decode(_:returnElementsBeforeError:)","abstract":"

    Read elements from the stream until no more bytes are available.

    ","parent_name":"BinaryStreamDecoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC13decodeElementxSgyKF":{"name":"decodeElement()","parent_name":"BinaryStreamDecoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC6fileAt7encoderACyxG10Foundation3URLV_AA0aD0CtKcfc":{"name":"init(fileAt:encoder:)","abstract":"

    Create a new file encoder.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5closeyyKF":{"name":"close()","abstract":"

    Close the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5writeyyxKF":{"name":"write(_:)","abstract":"

    Write a single element to the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5write10contentsOfyqd___tK7ElementQyd__RszSTRd__lF":{"name":"write(contentsOf:)","abstract":"

    Write a sequence of elements to the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC6fileAt7decoderACyxG10Foundation3URLV_AA0aD0CtKcfc":{"name":"init(fileAt:decoder:)","abstract":"

    Create a file decoder.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC5closeyyKF":{"name":"close()","abstract":"

    Close the file.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC4readyyyxXEKF":{"name":"read(_:)","abstract":"

    Read all elements in the file, and handle each element using a closure.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC7readAllSayxGyKF":{"name":"readAll()","abstract":"

    Read all elements at once.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC17readAllUntilErrorSayxGyF":{"name":"readAllUntilError()","abstract":"

    Read all elements at once, and ignore errors.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC11readElementxSgyKF":{"name":"readElement()","abstract":"

    Read a single elements from the current position in the file.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC22sortKeysDuringEncodingSbvp":{"name":"sortKeysDuringEncoding","abstract":"

    Sort keyed data in the binary representation.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC38prependNilIndexSetForUnkeyedContainersSbvp":{"name":"prependNilIndexSetForUnkeyedContainers","abstract":"

    Add a set of indices for nil values in unkeyed containers.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC39containsNilIndexSetForUnkeyedContainersSbvp":{"name":"containsNilIndexSetForUnkeyedContainers","abstract":"

    Assumes that unkeyed containers are encoded using a set of indices for nil values.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html":{"name":"BinaryDecoder","abstract":"

    An encoder to convert binary data back to Codable objects.

    "},"Classes/BinaryEncoder.html":{"name":"BinaryEncoder","abstract":"

    An encoder to convert Codable objects to binary data.

    "},"Classes/BinaryFileDecoder.html":{"name":"BinaryFileDecoder","abstract":"

    Read elements from a binary file.

    "},"Classes/BinaryFileEncoder.html":{"name":"BinaryFileEncoder","abstract":"

    Encode a stream of elements to a binary file.

    "},"Classes/BinaryStreamDecoder.html":{"name":"BinaryStreamDecoder","abstract":"

    Decode elements from a byte stream.

    "},"Classes/BinaryStreamEncoder.html":{"name":"BinaryStreamEncoder","abstract":"

    Encode elements sequentially into a binary data stream.

    "},"Classes/ProtobufDecoder.html":{"name":"ProtobufDecoder","abstract":"

    An encoder to convert protobuf binary data back to Codable objects.

    "},"Classes/ProtobufEncoder.html":{"name":"ProtobufEncoder","abstract":"

    An encoder to convert Codable objects to protobuf binary data.

    "},"binaryformat.html":{"name":"BinaryFormat"},"protobufsupport.html":{"name":"ProtobufSupport"},"Guides.html":{"name":"Guides","abstract":"

    The following guides are available globally.

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Enums.html":{"name":"Enumerations","abstract":"

    The following enumerations are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "}} \ No newline at end of file diff --git a/docs/docsets/.docset/Contents/Resources/Documents/undocumented.json b/docs/docsets/.docset/Contents/Resources/Documents/undocumented.json new file mode 100644 index 0000000..da2d01c --- /dev/null +++ b/docs/docsets/.docset/Contents/Resources/Documents/undocumented.json @@ -0,0 +1,6 @@ +{ + "warnings": [ + + ], + "source_directory": "/Users/ch/Projects/BinaryCodable" +} \ No newline at end of file diff --git a/docs/docsets/.docset/Contents/Resources/docSet.dsidx b/docs/docsets/.docset/Contents/Resources/docSet.dsidx index 8c09e8d..023b139 100644 Binary files a/docs/docsets/.docset/Contents/Resources/docSet.dsidx and b/docs/docsets/.docset/Contents/Resources/docSet.dsidx differ diff --git a/docs/docsets/.tgz b/docs/docsets/.tgz index 5ee31ff..7d20da5 100644 Binary files a/docs/docsets/.tgz and b/docs/docsets/.tgz differ diff --git a/docs/index.html b/docs/index.html index 45e6822..e1fcbe4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -55,6 +55,18 @@ + + + + @@ -171,7 +183,7 @@ - +

    @@ -247,6 +259,17 @@

    Errors

    All possible errors occuring during encoding produce BinaryEncodingError errors, while unsuccessful decoding produces BinaryDecodingErrors. Both are enums with several cases describing the nature of the error. See the documentation of the types to learn more about the different error conditions.

    +

    Handling corrupted data

    + +

    The binary format provides no provisions to detect data corruption, and various errors can occur as the result of added, changed, or missing bytes and bits. +Additional external measures (checksums, error-correcting codes, …) should be applied if there is an increased risk of data corruption.

    + +

    As an example, consider the simple encoding of a String inside a struct, which consists of a key followed by the length of the string in bytes, and the string content. +The length of the string is encoded using variable-length encoding, so a single bit flip (in the MSB of the length byte) could result in a very large length being decoded, causing the decoder to wait for a very large number of bytes to decode the string. +This simple error would cause much data to be skipped, potentially corrupting the data stream indefinitely. +At the same time, it is not possible to determine with certainty where the error occured, making error recovery difficult without additional information about boundaries between elements.

    + +

    The decoding errors provided by the library are therefore only hints about error likely occuring from non-conformance to the binary format or version incompatibility, which are not necessarily the true causes of the failures when data corruption is present.

    Coding Keys

    The Codable protocol uses CodingKey definitions to identify properties of instances. By default, coding keys are generated using the string values of the property names.

    @@ -303,12 +326,71 @@

    Fixed size integers

    There is an additional SignedValue wrapper, which is only useful when encoding in protobuf-compatible format.

    Options

    +

    Sorting keys

    The BinaryEncoder provides the sortKeysDuringEncoding option, which forces fields in “keyed” containers, such as struct properties (and some dictionaries), to be sorted in the binary data. This sorting is done by using either the integer keys (if defined), or the property names. Dictionaries with Int or String keys are also sorted.

    Sorting the binary data does not influence decoding, but introduces a computation penalty during encoding. It should therefore only be used if the binary data must be consistent across multiple invocations.

    -

    Note: The sortKeysDuringEncoding option does not guarantee deterministic binary data, and should be used with care.

    +

    Note: The sortKeysDuringEncoding option does not neccessarily guarantee deterministic binary data, and should be used with care.

    +

    Encoding optionals in arrays

    + +

    Sequences of Optional values (like arrays, sets, …) are normally encoded using a nil index set. +The index of each nil element in the sequence is recorded, and only non-nil values are encoded. +The indices of nil elements are then prepended to the data as an array of integers. +During decoding, this index set is checked to place nil values between the non-nil elements at the appropriate indices.

    + +

    This encoding scheme is usually more efficient than, e.g. indicating for each element whether the value is non-optional using an additional byte. +There can be specific cases where nil index sets become less efficient, e.g. when storing very large arrays of mostly nil values.

    + +

    In these cases, the encoder option prependNilIndexSetForUnkeyedContainers can be set to false, causing the encoder to omit the nil index set in favour of an additional byte before each element. +The decoder must then have containsNilIndexSetForUnkeyedContainers set to false, so that the data can be successfully decoded.

    +

    Stream encoding and decoding

    + +

    The library provides the option to perform encoding and decoding of continuous streams, such as when writing sequences of elements to a file, or when transmitting data over a network. +This functionality can be used through BinaryStreamEncoder and BinaryStreamDecoder, causing the encoder to embed additional information into the data to allow continuous decoding (mostly length information). +Encoding and decoding is always done with sequences of one specific type, since multiple types in one stream could not be distinguished from one another.

    + +

    Encoding of a stream works similarly to normal encoding:

    +
    let encoder = BinaryStreamEncoder<Int>()
    +let chunk1 = try encoder.encode(1)
    +let chunk2 = try encoder.encode(contentsOf: [2,3])
    +...
    +
    +let data = chunk1 + chunk2 + ...
    +
    + +

    Decoding of the individual chunks, with the decoder returning all elements which can be decoded using the currently available data.

    +
    let decoder = BinaryStreamDecoder<Int>()
    +let decoded1 = try decoder.decode(chunk1)
    +print(decoded1) // [1]
    +
    +let decoded2 = try decoder.decode(chunk2)
    +print(decoded2) // [2,3]
    +
    + +

    The decoder has an internal buffer, so incomplete data can be inserted into the decoder as it becomes available. The output of decode(_ data:) will be empty until the next complete element is processed.

    +

    File encoding and decoding

    + +

    Writing data streams to files is a common use case, so the library also provides wrappers around BinaryStreamEncoder and BinaryStreamDecoder to perform these tasks. +The BinaryFileEncoder can be used to sequentially write elements to a file:

    +
    let encoder = BinaryFileEncoder<DataElement>(fileAt: url)
    +try encoder.write(element1)
    +try encoder.write(element2)
    +...
    +try encoder.close() // Close the file
    +
    + +

    Elements will always be appended to the end of file, so existing files can be updated with additional data.

    + +

    Decoding works in a similar way, except with a callback to handle each element as it is decoded:

    +
    let decoder = BinaryFileDecoder<DataElement>(fileAt: url)
    +try decoder.read { element in
    +    // Process each element
    +}
    +
    + +

    There is also the possibility to read all elements at once using readAll(), or to read only one element at a time (readElement()).

    Protocol Buffer compatibility

    Achieving Protocol Buffer compatibility is described in ProtobufSupport.md.

    @@ -345,7 +427,7 @@

    Documentation

    diff --git a/docs/protobufsupport.html b/docs/protobufsupport.html index eccff2c..be53141 100644 --- a/docs/protobufsupport.html +++ b/docs/protobufsupport.html @@ -55,6 +55,18 @@ + + + + @@ -499,7 +511,7 @@

    Oneof

    diff --git a/docs/search.json b/docs/search.json index 0d23867..a00a4ab 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -{"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0xvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0ACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValueACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html":{"name":"FixedSize","abstract":"

    A wrapper for integer values which ensures that values are encoded in binary format using a fixed size.

    "},"Structs/SignedValue.html":{"name":"SignedValue","abstract":"

    A wrapper for integers more efficient for negative values.

    "},"Protocols/SignedValueCompatible.html#/s:13BinaryCodable21SignedValueCompatibleP17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"SignedValueCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","abstract":"

    The wire type of the type, which has a constant length

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","abstract":"

    The protobuf type equivalent to the fixed size type

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","abstract":"

    The value encoded as fixed size binary data

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","abstract":"

    Decode the value from binary data.

    ","parent_name":"FixedSizeCompatible"},"Protocols.html#/s:13BinaryCodable13ProtobufOneOfP":{"name":"ProtobufOneOf","abstract":"

    Add conformance to this protocol to enums which should be encoded as Protobuf Oneof values.

    "},"Protocols/FixedSizeCompatible.html":{"name":"FixedSizeCompatible","abstract":"

    An integer type which can be forced to use a fixed-length encoding instead of variable-length encoding.

    "},"Protocols/SignedValueCompatible.html":{"name":"SignedValueCompatible","abstract":"

    A signed integer which can be forced to use zig-zag encoding.

    "},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt64"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt32"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int64"},"Extensions/Int64.html#/s:s5Int64V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int64"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int32"},"Extensions/Int32.html#/s:s5Int32V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int32"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int"},"Extensions/Int.html#/s:Si13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int"},"Extensions.html#/s:13BinaryCodable11DecodingKeyO":{"name":"DecodingKey"},"Extensions.html#/s:13BinaryCodable21MixedCodingKeyWrapperV":{"name":"MixedCodingKeyWrapper"},"Extensions.html#/s:13BinaryCodable15ProtoKeyWrapperV":{"name":"ProtoKeyWrapper"},"Extensions.html#/s:13BinaryCodable13IntKeyWrapperV":{"name":"IntKeyWrapper"},"Extensions.html#/s:Sb":{"name":"Bool"},"Extensions.html#/s:10Foundation4DataV":{"name":"Data"},"Extensions.html#/s:Sf":{"name":"Float"},"Extensions/Int.html":{"name":"Int"},"Extensions/Int32.html":{"name":"Int32"},"Extensions/Int64.html":{"name":"Int64"},"Extensions.html#/s:SS":{"name":"String"},"Extensions/UInt.html":{"name":"UInt"},"Extensions/UInt32.html":{"name":"UInt32"},"Extensions/UInt64.html":{"name":"UInt64"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO015noValueInSingleG9ContaineryA2CmF":{"name":"noValueInSingleValueContainer","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO21nilValuesNotSupportedyA2CmF":{"name":"nilValuesNotSupported","abstract":"

    The encoded type contains optional values, which are not supported in the protocol buffer format.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17missingIntegerKeyyACSScACmF":{"name":"missingIntegerKey(_:)","abstract":"

    The encoded type contains properties which don’t have an integer key.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO31multipleTypesInUnkeyedContaineryA2CmF":{"name":"multipleTypesInUnkeyedContainer","abstract":"

    All values in unkeyed containers must have the same type.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20integerKeyOutOfRangeyACSicACmF":{"name":"integerKeyOutOfRange(_:)","abstract":"

    Field numbers must be positive integers not greater than 536870911 (2^29-1, or 0x1FFFFFFF)

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO26multipleContainersAccessedyA2CmF":{"name":"multipleContainersAccessed","abstract":"

    Multiple calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20noContainersAccessedyA2CmF":{"name":"noContainersAccessed","abstract":"

    No calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO23rootIsNotKeyedContaineryA2CmF":{"name":"rootIsNotKeyedContainer","abstract":"

    Protobuf requires an unkeyed container as the root node

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    An unavailable encoding feature was accessed.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO29protobufDefinitionUnavailableyACSScACmF":{"name":"protobufDefinitionUnavailable(_:)","parent_name":"ProtobufEncodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO23unexpectedDictionaryKeyyA2CmF":{"name":"unexpectedDictionaryKey","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    A decoding feature was accessed which is not supported for protobuf encoding.

    ","parent_name":"ProtobufDecodingError"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO21variableLengthIntegeryA2CmF":{"name":"variableLengthInteger","abstract":"

    An integer value encoded as a Base128 Varint.","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO4byteyA2CmF":{"name":"byte","abstract":"

    The value is encoded as a single byte.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO8twoBytesyA2CmF":{"name":"twoBytes","abstract":"

    The value is encoded as two bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO14variableLengthyA2CmF":{"name":"variableLength","abstract":"

    The value is encoded using first a length (as a UInt64 var-int) followed by the bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO9fourBytesyA2CmF":{"name":"fourBytes","abstract":"

    The value is encoded using four bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO10eightBytesyA2CmF":{"name":"eightBytes","abstract":"

    The value is encoded using eight bytes.

    ","parent_name":"DataType"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO06stringC6FailedyACSScACmF":{"name":"stringEncodingFailed(_:)","abstract":"

    A string could not be encoded to UTF-8.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO36multipleValuesInSingleValueContaineryA2CmF":{"name":"multipleValuesInSingleValueContainer","abstract":"

    A procedural error occuring during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO12invalidValueyACyp_s0cD0O7ContextVtcACmF":{"name":"invalidValue(_:_:)","abstract":"

    An indication that an encoder or its containers could not encode the given value.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15invalidDataSizeyA2CmF":{"name":"invalidDataSize","abstract":"

    The data for a primitive type did not have the right size.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO17missingDataForKeyyACs06CodingH0_pcACmF":{"name":"missingDataForKey(_:)","abstract":"

    The binary data is missing for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15unknownDataTypeyACSicACmF":{"name":"unknownDataType(_:)","abstract":"

    The binary data contained an unknown data type.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO18prematureEndOfDatayA2CmF":{"name":"prematureEndOfData","abstract":"

    The binary data ended before all values were decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13invalidStringyA2CmF":{"name":"invalidString","abstract":"

    A String contained in the data could not be decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO38variableLengthEncodedIntegerOutOfRangeyA2CmF":{"name":"variableLengthEncodedIntegerOutOfRange","abstract":"

    An integer encoded in the binary data as a varint does not fit into the specified integer type, producing an overflow.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO20multipleValuesForKeyyA2CmF":{"name":"multipleValuesForKey","abstract":"

    The binary data contains multiple values for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13dataCorruptedyACs0cD0O7ContextVcACmF":{"name":"dataCorrupted(_:)","abstract":"

    An indication that the data is corrupted or otherwise invalid.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO12typeMismatchyACypXp_s0cD0O7ContextVtcACmF":{"name":"typeMismatch(_:_:)","abstract":"

    An indication that a value of the given type could not be decoded because it did not match the type of what was found in the encoded payload.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13valueNotFoundyACypXp_s0cD0O7ContextVtcACmF":{"name":"valueNotFound(_:_:)","abstract":"

    An indication that a non-optional value of the given type was expected, but a null value was found.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during decoding.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html":{"name":"BinaryDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/BinaryEncodingError.html":{"name":"BinaryEncodingError","abstract":"

    An error thrown when encoding a value using BinaryEncoder.

    "},"Enums/DataType.html":{"name":"DataType","abstract":"

    The data type specifying how a value is encoded on the wire.

    "},"Enums/ProtobufDecodingError.html":{"name":"ProtobufDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/ProtobufEncodingError.html":{"name":"ProtobufEncodingError","abstract":"

    An error thrown when encoding a value using ProtobufEncoder.

    "},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"ProtobufDecoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC22sortKeysDuringEncodingSbvp":{"name":"sortKeysDuringEncoding","abstract":"

    Sort keyed data in the binary representation.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html":{"name":"BinaryDecoder","abstract":"

    An encoder to convert binary data back to Codable objects.

    "},"Classes/BinaryEncoder.html":{"name":"BinaryEncoder","abstract":"

    An encoder to convert Codable objects to binary data.

    "},"Classes/ProtobufDecoder.html":{"name":"ProtobufDecoder","abstract":"

    An encoder to convert protobuf binary data back to Codable objects.

    "},"Classes/ProtobufEncoder.html":{"name":"ProtobufEncoder","abstract":"

    An encoder to convert Codable objects to protobuf binary data.

    "},"binaryformat.html":{"name":"BinaryFormat"},"protobufsupport.html":{"name":"ProtobufSupport"},"Guides.html":{"name":"Guides","abstract":"

    The following guides are available globally.

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Enums.html":{"name":"Enumerations","abstract":"

    The following enumerations are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "}} \ No newline at end of file +{"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0xvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV07wrappedD0ACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/SignedValue.html#/s:13BinaryCodable11SignedValueV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"SignedValue"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP0cD4TypeQa":{"name":"IntegerLiteralType","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

    The value wrapped in the fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV12wrappedValueACyxGx_tcfc":{"name":"init(wrappedValue:)","abstract":"

    Wrap an integer value in a fixed-size container

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:s27ExpressibleByIntegerLiteralP07integerD0x0cD4TypeQz_tcfc":{"name":"init(integerLiteral:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV6encode2toys7Encoder_p_tKF":{"name":"encode(to:)","abstract":"

    Encode the wrapped value transparently to the given encoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4fromACyxGs7Decoder_p_tKcfc":{"name":"init(from:)","abstract":"

    Decode a wrapped value from a decoder.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3maxACyxGvpZ":{"name":"max","abstract":"

    The maximum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV3minACyxGvpZ":{"name":"min","abstract":"

    The minimum representable integer in this type.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html#/s:13BinaryCodable9FixedSizeV4zeroACyxGvpZ":{"name":"zero","abstract":"

    The zero value.

    ","parent_name":"FixedSize"},"Structs/FixedSize.html":{"name":"FixedSize","abstract":"

    A wrapper for integer values which ensures that values are encoded in binary format using a fixed size.

    "},"Structs/SignedValue.html":{"name":"SignedValue","abstract":"

    A wrapper for integers more efficient for negative values.

    "},"Protocols/SignedValueCompatible.html#/s:13BinaryCodable21SignedValueCompatibleP17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"SignedValueCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","abstract":"

    The wire type of the type, which has a constant length

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","abstract":"

    The protobuf type equivalent to the fixed size type

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","abstract":"

    The value encoded as fixed size binary data

    ","parent_name":"FixedSizeCompatible"},"Protocols/FixedSizeCompatible.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","abstract":"

    Decode the value from binary data.

    ","parent_name":"FixedSizeCompatible"},"Protocols.html#/s:13BinaryCodable13ProtobufOneOfP":{"name":"ProtobufOneOf","abstract":"

    Add conformance to this protocol to enums which should be encoded as Protobuf Oneof values.

    "},"Protocols/FixedSizeCompatible.html":{"name":"FixedSizeCompatible","abstract":"

    An integer type which can be forced to use a fixed-length encoding instead of variable-length encoding.

    "},"Protocols/SignedValueCompatible.html":{"name":"SignedValueCompatible","abstract":"

    A signed integer which can be forced to use zig-zag encoding.

    "},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt64"},"Extensions/UInt64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt64"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt32"},"Extensions/UInt32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt32"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"UInt"},"Extensions/UInt.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"UInt"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int64"},"Extensions/Int64.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int64"},"Extensions/Int64.html#/s:s5Int64V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int64"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int32"},"Extensions/Int32.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int32"},"Extensions/Int32.html#/s:s5Int32V13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int32"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD8DataTypeAA0gH0OvpZ":{"name":"fixedSizeDataType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP14fixedProtoTypeSSvp":{"name":"fixedProtoType","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP04fromcD0x10Foundation4DataV_tKcfc":{"name":"init(fromFixedSize:)","parent_name":"Int"},"Extensions/Int.html#/s:13BinaryCodable19FixedSizeCompatibleP05fixedD7Encoded10Foundation4DataVvp":{"name":"fixedSizeEncoded","parent_name":"Int"},"Extensions/Int.html#/s:Si13BinaryCodableE17positiveProtoTypeSSvp":{"name":"positiveProtoType","parent_name":"Int"},"Extensions.html#/s:13BinaryCodable11DecodingKeyO":{"name":"DecodingKey"},"Extensions.html#/s:13BinaryCodable21MixedCodingKeyWrapperV":{"name":"MixedCodingKeyWrapper"},"Extensions.html#/s:13BinaryCodable15ProtoKeyWrapperV":{"name":"ProtoKeyWrapper"},"Extensions.html#/s:13BinaryCodable13IntKeyWrapperV":{"name":"IntKeyWrapper"},"Extensions.html#/s:Sb":{"name":"Bool"},"Extensions.html#/s:10Foundation4DataV":{"name":"Data"},"Extensions.html#/s:Sf":{"name":"Float"},"Extensions/Int.html":{"name":"Int"},"Extensions/Int32.html":{"name":"Int32"},"Extensions/Int64.html":{"name":"Int64"},"Extensions.html#/s:SS":{"name":"String"},"Extensions/UInt.html":{"name":"UInt"},"Extensions/UInt32.html":{"name":"UInt32"},"Extensions/UInt64.html":{"name":"UInt64"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO015noValueInSingleG9ContaineryA2CmF":{"name":"noValueInSingleValueContainer","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO21nilValuesNotSupportedyA2CmF":{"name":"nilValuesNotSupported","abstract":"

    The encoded type contains optional values, which are not supported in the protocol buffer format.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO17missingIntegerKeyyACSScACmF":{"name":"missingIntegerKey(_:)","abstract":"

    The encoded type contains properties which don’t have an integer key.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO31multipleTypesInUnkeyedContaineryA2CmF":{"name":"multipleTypesInUnkeyedContainer","abstract":"

    All values in unkeyed containers must have the same type.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20integerKeyOutOfRangeyACSicACmF":{"name":"integerKeyOutOfRange(_:)","abstract":"

    Field numbers must be positive integers not greater than 536870911 (2^29-1, or 0x1FFFFFFF)

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO26multipleContainersAccessedyA2CmF":{"name":"multipleContainersAccessed","abstract":"

    Multiple calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO20noContainersAccessedyA2CmF":{"name":"noContainersAccessed","abstract":"

    No calls to container<>(keyedBy:), unkeyedContainer(), or singleValueContainer() for an encoder.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO23rootIsNotKeyedContaineryA2CmF":{"name":"rootIsNotKeyedContainer","abstract":"

    Protobuf requires an unkeyed container as the root node

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    An unavailable encoding feature was accessed.

    ","parent_name":"ProtobufEncodingError"},"Enums/ProtobufEncodingError.html#/s:13BinaryCodable21ProtobufEncodingErrorO29protobufDefinitionUnavailableyACSScACmF":{"name":"protobufDefinitionUnavailable(_:)","parent_name":"ProtobufEncodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO23unexpectedDictionaryKeyyA2CmF":{"name":"unexpectedDictionaryKey","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO17superNotSupportedyA2CmF":{"name":"superNotSupported","abstract":"

    Protocol buffers don’t support inheritance, so super can’t be encoded.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO15unsupportedTypeyACSScACmF":{"name":"unsupportedType(_:)","abstract":"

    The encoded type contains a basic type that is not supported.

    ","parent_name":"ProtobufDecodingError"},"Enums/ProtobufDecodingError.html#/s:13BinaryCodable21ProtobufDecodingErrorO13invalidAccessyACSScACmF":{"name":"invalidAccess(_:)","abstract":"

    A decoding feature was accessed which is not supported for protobuf encoding.

    ","parent_name":"ProtobufDecodingError"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO21variableLengthIntegeryA2CmF":{"name":"variableLengthInteger","abstract":"

    An integer value encoded as a Base128 Varint.","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO4byteyA2CmF":{"name":"byte","abstract":"

    The value is encoded as a single byte.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO8twoBytesyA2CmF":{"name":"twoBytes","abstract":"

    The value is encoded as two bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO14variableLengthyA2CmF":{"name":"variableLength","abstract":"

    The value is encoded using first a length (as a UInt64 var-int) followed by the bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO9fourBytesyA2CmF":{"name":"fourBytes","abstract":"

    The value is encoded using four bytes.

    ","parent_name":"DataType"},"Enums/DataType.html#/s:13BinaryCodable8DataTypeO10eightBytesyA2CmF":{"name":"eightBytes","abstract":"

    The value is encoded using eight bytes.

    ","parent_name":"DataType"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO06stringC6FailedyACSScACmF":{"name":"stringEncodingFailed(_:)","abstract":"

    A string could not be encoded to UTF-8.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO36multipleValuesInSingleValueContaineryA2CmF":{"name":"multipleValuesInSingleValueContainer","abstract":"

    A procedural error occuring during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO12invalidValueyACyp_s0cD0O7ContextVtcACmF":{"name":"invalidValue(_:_:)","abstract":"

    An indication that an encoder or its containers could not encode the given value.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryEncodingError.html#/s:13BinaryCodable0A13EncodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during encoding.

    ","parent_name":"BinaryEncodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15invalidDataSizeyA2CmF":{"name":"invalidDataSize","abstract":"

    The data for a primitive type did not have the right size.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO17missingDataForKeyyACs06CodingH0_pcACmF":{"name":"missingDataForKey(_:)","abstract":"

    The binary data is missing for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO15unknownDataTypeyACSicACmF":{"name":"unknownDataType(_:)","abstract":"

    The binary data contained an unknown data type.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO18prematureEndOfDatayA2CmF":{"name":"prematureEndOfData","abstract":"

    The binary data ended before all values were decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13invalidStringyA2CmF":{"name":"invalidString","abstract":"

    A String contained in the data could not be decoded.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO38variableLengthEncodedIntegerOutOfRangeyA2CmF":{"name":"variableLengthEncodedIntegerOutOfRange","abstract":"

    An integer encoded in the binary data as a varint does not fit into the specified integer type, producing an overflow.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO20multipleValuesForKeyyA2CmF":{"name":"multipleValuesForKey","abstract":"

    The binary data contains multiple values for a key.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13dataCorruptedyACs0cD0O7ContextVcACmF":{"name":"dataCorrupted(_:)","abstract":"

    An indication that the data is corrupted or otherwise invalid.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO12typeMismatchyACypXp_s0cD0O7ContextVtcACmF":{"name":"typeMismatch(_:_:)","abstract":"

    An indication that a value of the given type could not be decoded because it did not match the type of what was found in the encoded payload.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO13valueNotFoundyACypXp_s0cD0O7ContextVtcACmF":{"name":"valueNotFound(_:_:)","abstract":"

    An indication that a non-optional value of the given type was expected, but a null value was found.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html#/s:13BinaryCodable0A13DecodingErrorO07unknownD0yACs0D0_pcACmF":{"name":"unknownError(_:)","abstract":"

    An unexpected and unknown error occured during decoding.

    ","parent_name":"BinaryDecodingError"},"Enums/BinaryDecodingError.html":{"name":"BinaryDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/BinaryEncodingError.html":{"name":"BinaryEncodingError","abstract":"

    An error thrown when encoding a value using BinaryEncoder.

    "},"Enums/DataType.html":{"name":"DataType","abstract":"

    The data type specifying how a value is encoded on the wire.

    "},"Enums/ProtobufDecodingError.html":{"name":"ProtobufDecodingError","abstract":"

    An error produced while decoding binary data.

    "},"Enums/ProtobufEncodingError.html":{"name":"ProtobufEncodingError","abstract":"

    An error thrown when encoding a value using ProtobufEncoder.

    "},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufEncoder.html#/s:13BinaryCodable15ProtobufEncoderC6encodey10Foundation4DataVxKSERzlFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"ProtobufEncoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC8userInfoSDys010CodingUserF3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"ProtobufDecoder"},"Classes/ProtobufDecoder.html#/s:13BinaryCodable15ProtobufDecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"ProtobufDecoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC7encoderACyxGAA0aD0C_tcfc":{"name":"init(encoder:)","abstract":"

    Create a new stream encoder.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC6encodey10Foundation4DataVxKF":{"name":"encode(_:)","abstract":"

    Encode an element for the data stream.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamEncoder.html#/s:13BinaryCodable0A13StreamEncoderC6encode10contentsOf10Foundation4DataVqd___tK7ElementQyd__RszSTRd__lF":{"name":"encode(contentsOf:)","abstract":"

    Encode a sequence of elements.

    ","parent_name":"BinaryStreamEncoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC7decoderACyxGAA0aD0C_tcfc":{"name":"init(decoder:)","abstract":"

    Create a stream decoder.

    ","parent_name":"BinaryStreamDecoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC6decode_25returnElementsBeforeErrorSayxG10Foundation4DataV_SbtKF":{"name":"decode(_:returnElementsBeforeError:)","abstract":"

    Read elements from the stream until no more bytes are available.

    ","parent_name":"BinaryStreamDecoder"},"Classes/BinaryStreamDecoder.html#/s:13BinaryCodable0A13StreamDecoderC13decodeElementxSgyKF":{"name":"decodeElement()","parent_name":"BinaryStreamDecoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC6fileAt7encoderACyxG10Foundation3URLV_AA0aD0CtKcfc":{"name":"init(fileAt:encoder:)","abstract":"

    Create a new file encoder.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5closeyyKF":{"name":"close()","abstract":"

    Close the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5writeyyxKF":{"name":"write(_:)","abstract":"

    Write a single element to the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileEncoder.html#/s:13BinaryCodable0A11FileEncoderC5write10contentsOfyqd___tK7ElementQyd__RszSTRd__lF":{"name":"write(contentsOf:)","abstract":"

    Write a sequence of elements to the file.

    ","parent_name":"BinaryFileEncoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC6fileAt7decoderACyxG10Foundation3URLV_AA0aD0CtKcfc":{"name":"init(fileAt:decoder:)","abstract":"

    Create a file decoder.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC5closeyyKF":{"name":"close()","abstract":"

    Close the file.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC4readyyyxXEKF":{"name":"read(_:)","abstract":"

    Read all elements in the file, and handle each element using a closure.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC7readAllSayxGyKF":{"name":"readAll()","abstract":"

    Read all elements at once.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC17readAllUntilErrorSayxGyF":{"name":"readAllUntilError()","abstract":"

    Read all elements at once, and ignore errors.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryFileDecoder.html#/s:13BinaryCodable0A11FileDecoderC11readElementxSgyKF":{"name":"readElement()","abstract":"

    Read a single elements from the current position in the file.

    ","parent_name":"BinaryFileDecoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC22sortKeysDuringEncodingSbvp":{"name":"sortKeysDuringEncoding","abstract":"

    Sort keyed data in the binary representation.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC38prependNilIndexSetForUnkeyedContainersSbvp":{"name":"prependNilIndexSetForUnkeyedContainers","abstract":"

    Add a set of indices for nil values in unkeyed containers.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for encoding.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKF":{"name":"encode(_:)","abstract":"

    Encode a value to binary data.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryEncoder.html#/s:13BinaryCodable0A7EncoderC6encodey10Foundation4DataVSE_pKFZ":{"name":"encode(_:)","abstract":"

    Encode a single value to binary data using a default encoder.

    ","parent_name":"BinaryEncoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC8userInfoSDys010CodingUserE3KeyVypGvp":{"name":"userInfo","abstract":"

    Any contextual information set by the user for decoding.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC39containsNilIndexSetForUnkeyedContainersSbvp":{"name":"containsNilIndexSetForUnkeyedContainers","abstract":"

    Assumes that unkeyed containers are encoded using a set of indices for nil values.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderCACycfc":{"name":"init()","abstract":"

    Create a new binary encoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlF":{"name":"decode(_:from:)","abstract":"

    Decode a type from binary data.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html#/s:13BinaryCodable0A7DecoderC6decode_4fromxxm_10Foundation4DataVtKSeRzlFZ":{"name":"decode(_:from:)","abstract":"

    Decode a single value from binary data using a default decoder.

    ","parent_name":"BinaryDecoder"},"Classes/BinaryDecoder.html":{"name":"BinaryDecoder","abstract":"

    An encoder to convert binary data back to Codable objects.

    "},"Classes/BinaryEncoder.html":{"name":"BinaryEncoder","abstract":"

    An encoder to convert Codable objects to binary data.

    "},"Classes/BinaryFileDecoder.html":{"name":"BinaryFileDecoder","abstract":"

    Read elements from a binary file.

    "},"Classes/BinaryFileEncoder.html":{"name":"BinaryFileEncoder","abstract":"

    Encode a stream of elements to a binary file.

    "},"Classes/BinaryStreamDecoder.html":{"name":"BinaryStreamDecoder","abstract":"

    Decode elements from a byte stream.

    "},"Classes/BinaryStreamEncoder.html":{"name":"BinaryStreamEncoder","abstract":"

    Encode elements sequentially into a binary data stream.

    "},"Classes/ProtobufDecoder.html":{"name":"ProtobufDecoder","abstract":"

    An encoder to convert protobuf binary data back to Codable objects.

    "},"Classes/ProtobufEncoder.html":{"name":"ProtobufEncoder","abstract":"

    An encoder to convert Codable objects to protobuf binary data.

    "},"binaryformat.html":{"name":"BinaryFormat"},"protobufsupport.html":{"name":"ProtobufSupport"},"Guides.html":{"name":"Guides","abstract":"

    The following guides are available globally.

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Enums.html":{"name":"Enumerations","abstract":"

    The following enumerations are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "}} \ No newline at end of file