ByteBuffer
public protocol ByteBuffer
This is a protocal created for handling the retrieval of various numbers and strings
-
Undocumented
Declaration
Swift
var bytes: [UInt8] { get set } -
Undocumented
Declaration
Swift
var count: Int { get } -
getUInt8(_:Extension method) Call this function for retriving a UInt8 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getUInt8(1)Declaration
Swift
public func getUInt8(_ offset: Int) throws -> UInt8 -
getUInt16(_:Extension methodbigEndian: ) Call this function for retriving a UInt16 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getUInt16(1)Declaration
Swift
public func getUInt16(_ offset: Int, bigEndian: Bool? = false) throws -> UInt16 -
getUInt32(_:Extension methodbigEndian: ) Call this function for retriving a UInt32 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getUInt32(1)Declaration
Swift
public func getUInt32(_ offset: Int, bigEndian: Bool? = false) throws -> UInt32 -
getUInt64(_:Extension methodbigEndian: ) Call this function for retriving a UInt64 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getUInt64(1)Declaration
Swift
public func getUInt64(_ offset: Int, bigEndian: Bool? = false) throws -> UInt64 -
getInt8(_:Extension method) Call this function for retriving a Int8 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getInt8(1)Declaration
Swift
public func getInt8(_ offset: Int) throws -> Int8 -
getInt16(_:Extension methodbigEndian: ) Call this function for retriving a Int16 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getInt16(1)Declaration
Swift
public func getInt16(_ offset: Int, bigEndian: Bool? = false) throws -> Int16 -
getInt32(_:Extension methodbigEndian: ) Call this function for retriving a Int32 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getInt32(1)Declaration
Swift
public func getInt32(_ offset: Int, bigEndian: Bool? = false) throws -> Int32 -
getInt64(_:Extension methodbigEndian: ) Call this function for retriving a Int64 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getInt64(1)Declaration
Swift
public func getInt64(_ offset: Int, bigEndian: Bool? = false) throws -> Int64 -
getInt(_:Extension methodbigEndian: ) Call this function for retriving a generic Int at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getInt(1)Declaration
Swift
public func getInt(_ offset: Int, bigEndian: Bool? = false) throws -> Int -
getFloat32(_:Extension methodbigEndian: ) Call this function for retriving a Float32 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getFloat32(1)Declaration
Swift
public func getFloat32(_ offset: Int, bigEndian: Bool? = false) throws -> Float32 -
getFloat64(_:Extension methodbigEndian: ) Call this function for retriving a Float64 at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getFloat64(1)Declaration
Swift
public func getFloat64(_ offset: Int, bigEndian: Bool? = false) throws -> Float64 -
getFloat(_:Extension methodbigEndian: ) Call this function for retriving a generic Float at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getFloat(1)Declaration
Swift
public func getFloat(_ offset: Int, bigEndian: Bool? = false) throws -> Float -
getDouble(_:Extension methodbigEndian: ) Call this function for retriving a Double at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getDouble(1)Declaration
Swift
public func getDouble(_ offset: Int, bigEndian: Bool? = false) throws -> Double -
getBool(_:Extension method) Call this function for retriving a Bool at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getBool(1)Declaration
Swift
public func getBool(_ offset: Int) throws -> Bool -
getNullTerminatedUTF8String(_:Extension method) Call this function for retriving a Null Terminated UTF8 String at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getNullTerminatedUTF8String(28)Declaration
Swift
public func getNullTerminatedUTF8String(_ offset: Int) throws -> String -
getUTF8String(_:Extension methodlength: ) Call this function for retriving a UTF8 String at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getUTF8String(1, length: 6)Declaration
Swift
public func getUTF8String(_ offset: Int, length: Int) throws -> String -
getString(_:Extension method_: ) Call this function for retriving a String at a specific offset in the array
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getString(1, .ascii)Declaration
Swift
public func getString(_ offset: Int, _ encoding: String.Encoding) throws -> String -
getVariableLengthString(_:Extension method_: ) Call this function for retriving a 7 Bit Encoded Variable Length String at a specific offset in the array.
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getVariableLengthString(1, .ascii)Declaration
Swift
public func getVariableLengthString(_ offset: Int, _ encoding: String.Encoding) throws -> String -
subData(_:Extension method_: ) Call this function for retriving a Array of UInt8(Bytes) at a specific offset in the array.
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.subData(1, 10)Declaration
Swift
public func subData(_ offset: Int, _ length: Int) throws -> [UInt8] -
getBit(_:Extension method_: ) Call this function for retriving a bit value at a specific offset in the array.
Usage Example:
var readData: BinaryData = writeTest.data let num = readData.getBit(1, 4)Declaration
Swift
public func getBit(_ offset: Int, _ bitIndex: Int) throws -> UInt8
ByteBuffer Protocol Reference