Skip to content

Commit

Permalink
Update BinaryReader.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin committed Nov 15, 2023
1 parent 2b4aa0c commit a864a76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/BinaryReader/BinaryReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,12 @@ public class BinaryReader: Readable {
return try readUInt8() != 0
}

public func readString(length : UInt) throws -> String {
let bytes = try readBytes(count: UInt(length))
return String(bytes: bytes, encoding: .utf8) ?? ""
}

public func readString() throws -> String {

var header = try readUInt8()
var length = header & 0x7F

Expand Down

0 comments on commit a864a76

Please sign in to comment.