Documentation
¶
Overview ¶
Package buf-readerat implements buffered io.ReaderAt. It wraps an io.ReaderAt object, creating another io.ReaderAt object that also implements the interface but provides buffering.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufReaderAt ¶
type BufReaderAt struct {
// contains filtered or unexported fields
}
BufReaderAt implements buffering for an io.ReaderAt object.
Example (ReadAt) ¶
package main import ( "bytes" "fmt" "log" bufra "github.com/avvmoto/buf-readerat" ) func main() { r := bytes.NewReader([]byte("123456789")) bra := bufra.NewBufReaderAt(r, 8) buf := make([]byte, 4) if _, err := bra.ReadAt(buf, 4); err != nil { log.Fatal(err) } fmt.Printf("%s\n", buf) }
Output: 5678
func NewBufReaderAt ¶
func NewBufReaderAt(readerAt io.ReaderAt, size int) *BufReaderAt
NewBufReaderAt returns a new BufReaderAt whose buffer has the specified size.
Click to show internal directories.
Click to hide internal directories.