This commit is contained in:
Jae Kwon
2014-06-25 21:37:20 -07:00
parent c0bf95eb73
commit c895c6a586
12 changed files with 78 additions and 48 deletions

View File

@ -117,6 +117,13 @@ func ReadUInt8(r io.Reader) UInt8 {
return UInt8(buf[0])
}
func ReadUInt8Safe(r io.Reader) (UInt8, error) {
buf := [1]byte{0}
_, err := io.ReadFull(r, buf[:])
if err != nil { return UInt8(0), err }
return UInt8(buf[0]), nil
}
// Int16