Imports #
"bufio"
"io"
"log"
"os"
"runtime"
"sync/atomic"
"syscall"
"io"
"log"
"bufio"
"io"
"log"
"os"
"runtime"
"sync/atomic"
"syscall"
"io"
"log"
mmapLimit is the maximum number of mmaped regions to create before falling back to reading into a heap-allocated slice. This exists because some operating systems place a limit on the number of distinct mapped regions per process. As of this writing: Darwin unlimited DragonFly 1000000 (vm.max_proc_mmap) FreeBSD unlimited Linux 65530 (vm.max_map_count) // TODO: query /proc/sys/vm/max_map_count? NetBSD unlimited OpenBSD unlimited
var mmapLimit int32 = *ast.BinaryExpr
Reader implements a seekable buffered io.Reader.
type Reader struct {
f *os.File
*bufio.Reader
}
Writer implements a seekable buffered io.Writer.
type Writer struct {
f *os.File
*bufio.Writer
}
type mustWriter struct {
w io.Writer
}
func (r *Reader) Close() error
func (w *Writer) Close() error
Create creates the file named name and returns a Writer for that file.
func Create(name string) (*Writer, error)
func (w *Writer) File() *os.File
func (r *Reader) File() *os.File
MustClose closes Closer c and calls log.Fatal if it returns a non-nil error.
func MustClose(c io.Closer)
func (r *Reader) MustSeek(offset int64, whence int) int64
func (w *Writer) MustSeek(offset int64, whence int) int64
MustWriter returns a Writer that wraps the provided Writer, except that it calls log.Fatal instead of returning a non-nil error.
func MustWriter(w io.Writer) io.Writer
NewReader returns a Reader from an open file.
func NewReader(f *os.File) *Reader
func (r *Reader) Offset() int64
func (w *Writer) Offset() int64
Open returns a Reader for the file named name.
func Open(name string) (*Reader, error)
Slice reads the next length bytes of r into a slice. This slice may be backed by mmap'ed memory. Currently, this memory will never be unmapped. The second result reports whether the backing memory is read-only.
func (r *Reader) Slice(length uint64) ([]byte, bool, error)
SliceRO returns a slice containing the next length bytes of r backed by a read-only mmap'd data. If the mmap cannot be established (limit exceeded, region too small, etc) a nil slice will be returned. If mmap succeeds, it will never be unmapped.
func (r *Reader) SliceRO(length uint64) []byte
func (w mustWriter) Write(b []byte) (int, error)
func (w mustWriter) WriteString(s string) (int, error)
func init()
func (r *Reader) sliceOS(length uint64) ([]byte, bool)
func (r *Reader) sliceOS(length uint64) ([]byte, bool)
Generated with Arrow