aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index 9e9807a..6e70b37 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,10 @@
1# BitReader [![Go Report Card](https://goreportcard.com/badge/github.com/pektezol/bitreader)](https://goreportcard.com/report/github.com/pektezol/bitreader) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/pektezol/bitreader/blob/main/LICENSE) [![Go Reference](https://pkg.go.dev/badge/github.com/pektezol/bitreader.svg)](https://pkg.go.dev/github.com/pektezol/bitreader) 1# BitReader [![Go Report Card](https://goreportcard.com/badge/github.com/pektezol/bitreader)](https://goreportcard.com/report/github.com/pektezol/bitreader) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/pektezol/bitreader/blob/main/LICENSE) [![Go Reference](https://pkg.go.dev/badge/github.com/pektezol/bitreader.svg)](https://pkg.go.dev/github.com/pektezol/bitreader)
2A simple bit reader with big/little-endian support for golang.\ 2A simple bit reader with big/little-endian support for golang.\
3Reads data from an existing byte array.\ 3Reads stream data from an io.Reader; can read from os.File and a byte array with bytes.NewReader(array).\
4Uses string manipulation (for now).\ 4Uses bitwise operations.\
5Support reading up to 64 bits at one time.\ 5Support reading up to 64 bits at one time.\
6Checking for overflowing the data. 6Includes wrapper functions for most used data types.\
7Error checking on all but wrapper functions.\
7 8
8## Installation 9## Installation
9```bash 10```bash
@@ -30,7 +31,11 @@ err := reader.SkipBytes(4)
30value, err := reader.ReadBytes(4) 31value, err := reader.ReadBytes(4)
31value, err := reader.ReadBits(64) // up to 64 bits 32value, err := reader.ReadBits(64) // up to 64 bits
32 33
34// Read String
35value, err := reader.ReadString() // null-terminated
36
33// Wrapper functions 37// Wrapper functions
38text := reader.ReadString() // string
34state := reader.TryReadBool() // bool 39state := reader.TryReadBool() // bool
35value := reader.TryReadInt1() // uint8 40value := reader.TryReadInt1() // uint8
36value := reader.TryReadInt8() // uint8 41value := reader.TryReadInt8() // uint8
@@ -42,7 +47,7 @@ value := reader.TryReadFloat64() // float64
42``` 47```
43 48
44## Error Handling 49## Error Handling
45ReadBits(x), ReadBytes(x), ReadBool(), SkipBits(x) and SkipBytes(x) functions returns an error message when they don't work as expected. It is advised to always handle errors. \ 50ReadBits(x), ReadBytes(x), ReadBool(), ReadString(), SkipBits(x) and SkipBytes(x) functions returns an error message when they don't work as expected. It is advised to always handle errors. \
46Wrapper functions, however, only returns the value and panics if an error is encountered. 51Wrapper functions, however, only returns the value and panics if an error is encountered.
47 52
48## Bug Report / Feature Request 53## Bug Report / Feature Request