GitXplorerGitXplorer
g

go-stream

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.

No commits found

There are no commits on branch master.

README

The README file for this repository.

go-stream

Introduction

stream is a Go library which provides a buffered reader with convenient functions.

Usage

The following example parses what looks like a HTTP header. Error return values are ignored.

s := stream.NewStreamBytes([]byte("Content-Length: 42\r\n"))
s.ReadUntilByteAndSkip(':') // yields []byte("Content-Length")
s.SkipWhile(func(b byte) bool {
	return b == ' ' || b == '\t'
})
s.ReadUntilAndSkip([]byte{'\r', '\n'}) // yields []byte("42")

Contact

If you have an idea or a question, email me at khaelin@gmail.com.