aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md16
1 files changed, 11 insertions, 5 deletions
diff --git a/README.md b/README.md
index 1093153..2bc00e7 100644
--- a/README.md
+++ b/README.md
@@ -28,16 +28,22 @@ err := reader.SkipBits(8)
28err := reader.SkipBytes(4) 28err := reader.SkipBytes(4)
29 29
30// Read Bits/Bytes 30// Read Bits/Bytes
31value, err := reader.ReadBytes(4) 31value, err := reader.ReadBytes(4) // up to 8 bytes
32value, err := reader.ReadBits(64) // up to 64 bits 32value, err := reader.ReadBits(64) // up to 64 bits
33 33
34// Read String 34// Read String
35text, err := reader.ReadString() // null-terminated 35text, err := reader.ReadString() // null-terminated
36text, err := reader.ReadStringLen(256) // length-specified 36text, err := reader.ReadStringLen(256) // length-specified
37
38// Read Bits/Bytes into Slice
39arr, err := reader.ReadBitsToSlice(128)
40arr, err := reader.ReadBytesToSlice(64)
37 41
38// Wrapper functions 42// Wrapper functions
39text := reader.TryReadString() // string 43text := reader.TryReadString() // string
40text := reader.TryReadStringLen(64) // string 44text := reader.TryReadStringLen(64) // string
45arr := reader.ReadBitsToSlice(128) // []byte
46arr := reader.ReadBytesToSlice(64) // []byte
41state := reader.TryReadBool() // bool 47state := reader.TryReadBool() // bool
42value := reader.TryReadInt1() // uint8 48value := reader.TryReadInt1() // uint8
43value := reader.TryReadInt8() // uint8 49value := reader.TryReadInt8() // uint8
@@ -51,7 +57,7 @@ value := reader.TryReadBytes(8) // uint64
51``` 57```
52 58
53## Error Handling 59## Error Handling
54ReadBits(x), ReadBytes(x), ReadBool(), ReadString(), ReadStringLen(x) SkipBits(x) and SkipBytes(x) functions returns an error message when they don't work as expected. It is advised to always handle errors. \ 60ReadBits(x), ReadBytes(x), ReadBool(), ReadString(), ReadStringLen(x), ReadBitsToSlice(x), ReadBytesToSlice(x), SkipBits(x) and SkipBytes(x) functions returns an error message when they don't work as expected. It is advised to always handle errors. \
55Wrapper functions, however, only returns the value and panics if an error is encountered. 61Wrapper functions, however, only returns the value and panics if an error is encountered.
56 62
57## Bug Report / Feature Request 63## Bug Report / Feature Request