package recordio
import "github.com/mesos/mesos-go/api/v1/lib/recordio"
Package recordio implements the Mesos variant of RecordIO framing, whereby
each record is prefixed by a line that indicates the length of the record in
decimal ASCII. The bytes of the record immediately follow the length-line.
Zero-length records are allowed.
Code:play
Output:Example¶
package main
import (
"fmt"
"io"
"strings"
"github.com/mesos/mesos-go/api/v1/lib/recordio"
)
func main() {
var (
r = recordio.NewReader(strings.NewReader("6\nhello 0\n6\nworld!"))
lines []string
)
for {
fr, err := r.ReadFrame()
if err == io.EOF {
break
}
if err != nil {
panic(err)
}
lines = append(lines, string(fr))
}
fmt.Println(lines)
}
[hello world!]
Index ¶
- func NewReader(read io.Reader, opt ...Opt) framing.Reader
- func ParseUintBytes(s []byte, base int, bitSize int) (n uint64, err error)
- type Opt
- type Writer
Examples ¶
Functions ¶
func NewReader ¶
NewReader returns a reader that parses frames from a recordio stream.
func ParseUintBytes ¶
ParseUintBytes is like strconv.ParseUint, but using a []byte.
Types ¶
type Opt ¶
type Opt func(*reader)
func MaxMessageSize ¶
MaxMessageSize returns a functional option that configures the internal Scanner's buffer and max token (message) length, in bytes.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter ¶
func (*Writer) WriteFrame ¶
Source Files ¶
doc.go reader.go strconv.go writer.go
- Version
- v0.0.11 (latest)
- Published
- May 15, 2020
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 2 hours ago –
Tools for package owners.