Documentation
¶
Overview ¶
Package trackedoffset provides readers and writers that will keep track of the current offset as data is being read or written to and from.
Index ¶
- type File
- func (f *File) Close() error
- func (f *File) Flush() error
- func (f *File) Name() string
- func (f *File) Offset() uint64
- func (f *File) Read(p []byte) (int, error)
- func (f *File) ReadByte() (byte, error)
- func (f *File) ResetReadBuffer()
- func (f *File) ResetWriteBuffer()
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sync() error
- func (f *File) SyncOffset() error
- func (f *File) Write(p []byte) (int, error)
- func (f *File) WriteByte(c byte) error
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File wraps an os.File and keeps track of the current offset without requiring constant calls to Seek which involves syscall Lseek to be made. Reading and Writing is buffered by using the bufio package. Implements the following interfaces: io.Reader, io.Writer, io.Seeker, io.ByteReader.
func OpenFile ¶
Wraps os.OpenFile to allow for more options.
func (*File) ResetReadBuffer ¶
func (f *File) ResetReadBuffer()
Discard any buffered data that has not yet been read. Ensure you call this if you have changed the current offset using Seek.
func (*File) ResetWriteBuffer ¶
func (f *File) ResetWriteBuffer()
Discard any buffered data that has not yet been written. Ensure you call this if you have changed the current offset using Seek.
func (*File) SyncOffset ¶
Ensure the File's offset and the underlying os.File's actual offsets are the same. This will make a call to file.Seek.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader keeps track of the offset within an io.Reader source.
func NewReader ¶
Create a new Reader that will keep track of the offset within the source io.Reader. baseOffset is the known starting offset.
func (*Reader) ResetOffset ¶
Set the known offset in bytes.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer keeps track of the offset within an io.Writer source.
func NewWriter ¶
Create a new Writer that will keep track of the offset within the source io.Writer.
func (*Writer) ResetOffset ¶
Set the known offset in bytes.