BigEndianByteReader
public final class BigEndianByteReader : ByteReader
A type that contains functions for reading Data byte-by-byte in the Big Endian order.
-
Size of the
data(in bytes).Declaration
Swift
public let size: Int -
Data which is being read.
Declaration
Swift
public let data: Data -
Offset to a byte in the
datawhich will be read next.Declaration
Swift
public var offset: Int -
Creates an instance for reading bytes from the
data.Declaration
Swift
public init(data: Data) -
Reads a byte and returns it, advancing by one position.
Precondition
There must be enough bytes left.Declaration
Swift
public func byte() -> UInt8 -
Reads
countbytes and returns them as a[UInt8]array, advancing bycountpositions.Precondition
Parametercountmust be non-negative.Precondition
There must be enough bytes left.Declaration
Swift
public func bytes(count: Int) -> [UInt8] -
Reads 8 bytes and returns them as a
UInt64number, advancing by 8 positions.Precondition
There must be enough bytes left.Declaration
Swift
public func uint64() -> UInt64 -
Reads
fromBytesbytes and returns them as aUInt64number, advancing byfromBytespositions.Note
If it is known that thefromBytesis exactly 8 then consider using theuint64()function (without an argument), since it may provide better performance.Precondition
ParameterfromBytesmust be in the0...8range.Precondition
There must be enough bytes left.Declaration
Swift
public func uint64(fromBytes count: Int) -> UInt64 -
Reads 4 bytes and returns them as a
UInt32number, advancing by 4 positions.Precondition
There must be enough bytes left.Declaration
Swift
public func uint32() -> UInt32 -
Reads
fromBytesbytes and returns them as aUInt32number, advancing byfromBytespositions.Note
If it is known that thefromBytesis exactly 4 then consider using theuint32()function (without an argument), since it may provide better performance.Precondition
ParameterfromBytesmust be in the0...4range.Precondition
There must be enough bytes left.Declaration
Swift
public func uint32(fromBytes count: Int) -> UInt32 -
Reads 2 bytes and returns them as a
UInt16number, advancing by 2 positions.Precondition
There must be enough bytes left.Declaration
Swift
public func uint16() -> UInt16 -
Reads
fromBytesbytes and returns them as aUInt16number, advancing byfromBytespositions.Note
If it is known that thefromBytesis exactly 2 then consider using theuint16()function (without an argument), since it may provide better performance.Precondition
ParameterfromBytesmust be in the0...2range.Precondition
There must be enough bytes left.Declaration
Swift
public func uint16(fromBytes count: Int) -> UInt16
View on GitHub
BigEndianByteReader Class Reference