GitXplorerGitXplorer
g

go-stream

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
84cb1343e9534a671d45f818afcb5b832c68f0ea

fix readme syntax error

ggaldor committed 8 years ago
Unverified
dce1f0686ffbb2065f780f8cc871d69e358ea652

update readme

ggaldor committed 8 years ago
Unverified
0bec63b2a401c617a0e8e85541752560afd69732

initial import

ggaldor committed 8 years ago

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.