BinaryReader
public class BinaryReader
This is a class created for reading data in a linear order
-
Undocumented
Declaration
Swift
public private(set) var readIndex: Int { get } -
Undocumented
Declaration
Swift
public private(set) var bitReadIndex: Int { get } -
Undocumented
Declaration
Swift
public let data: BinaryData -
Undocumented
Declaration
Swift
public init(_ data: BinaryData, _ readIndex: Int = 0, _ bitReadIndex: Int = 0) -
Undocumented
Declaration
Swift
public init(_ data: [UInt8], _ readIndex: Int = 0, _ bitReadIndex: Int = 0) -
Call this function for retriving a UInt8 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readUInt8()Declaration
Swift
public func readUInt8() throws -> UInt8 -
Call this function for retriving an Int8 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readInt8()Declaration
Swift
public func readInt8() throws -> Int8 -
Call this function for retriving a UInt16 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readUInt16()Declaration
Swift
public func readUInt16(_ bigEndian: Bool? = false) throws -> UInt16 -
Call this function for retriving a Int16 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readInt16()Declaration
Swift
public func readInt16(_ bigEndian: Bool? = false) throws -> Int16 -
Call this function for retriving a UInt32 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readUInt32()Declaration
Swift
public func readUInt32(_ bigEndian: Bool? = false) throws -> UInt32 -
Call this function for retriving a Int32 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readInt32()Declaration
Swift
public func readInt32(_ bigEndian: Bool? = false) throws -> Int32 -
Call this function for retriving a UInt64 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readUInt64()Declaration
Swift
public func readUInt64(_ bigEndian: Bool? = false) throws -> UInt64 -
Call this function for retriving a Int64 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readInt64()Declaration
Swift
public func readInt64(_ bigEndian: Bool? = false) throws -> Int64 -
Call this function for retriving a Float32 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readFloat32()Declaration
Swift
public func readFloat32(_ bigEndian: Bool? = false) throws -> Float32 -
Call this function for retriving a Float64 at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readFloat64()Declaration
Swift
public func readFloat64(_ bigEndian: Bool? = false) throws -> Float64 -
Call this function for retriving a generic Float at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readFloat()Declaration
Swift
public func readFloat(_ bigEndian: Bool? = false) throws -> Float -
Call this function for retriving a Double at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readDouble()Declaration
Swift
public func readDouble(_ bigEndian: Bool? = false) throws -> Double -
Call this function for retriving a Bool at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readBool()Declaration
Swift
public func readBool() throws -> Bool -
Call this function for retriving a Null Terminated UTF8 String at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readNullTerminatedUTF8String()Declaration
Swift
public func readNullTerminatedUTF8String() throws -> String -
Call this function for retriving a 7 bit encoded string at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readVariableLengthString(.ascii)Declaration
Swift
public func readVariableLengthString(_ encoding: String.Encoding) throws -> String -
Call this function for retriving a Length prefixed String at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readString(.ascii)Declaration
Swift
public func readString(_ encoding: String.Encoding) throws -> String -
Call this function for retriving a Known Length UTF8 String at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.readUTF8String(2)Declaration
Swift
public func readUTF8String(_ length: Int) throws -> String -
Call this function for retriving a given amount of bytes at the current position of the array and increment.
Usage Example:
var readData: BinaryData = writeTest.data var reader: BinaryReader = BinaryReader(readData) try reader.read(10)Declaration
Swift
public func read(_ length: Int) throws -> [UInt8] -
Undocumented
Declaration
Swift
public func readBit() throws -> UInt8 -
Call this function to move/advance the index forward by a certain amount
Declaration
Swift
public func adv(_ length: Int) -
Call this function to jump to a specific position/index in the data array
Declaration
Swift
public func jmp(_ position: Int)
BinaryReader Class Reference