Documentation ¶
Overview ¶
Maybe I need to set the read size? n, err := io.Reader.Read(something); n will not be more that 512 unless I set something (ran into this in archive) Only happens when Stop() is run. Why?? Make sure read time is similar between standard reader and dbr.
Index ¶
- type DiskBufferReader
- func (dbr *DiskBufferReader) Close() error
- func (dbr *DiskBufferReader) Read(out []byte) (int, error)
- func (dbr *DiskBufferReader) ReadAt(out []byte, offset int64) (int, error)
- func (dbr *DiskBufferReader) Reset() error
- func (dbr *DiskBufferReader) Seek(offset int64, whence int) (int64, error)
- func (dbr *DiskBufferReader) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskBufferReader ¶
type DiskBufferReader struct {
// contains filtered or unexported fields
}
DiskBufferReader uses an io.Reader and stores read bytes to a tmp file so the reader can be reset to the start.
func New ¶
func New(r io.Reader) (*DiskBufferReader, error)
New takes an io.Reader and creates returns an initialized DiskBufferReader.
func (*DiskBufferReader) Close ¶
func (dbr *DiskBufferReader) Close() error
Close the reader and delete the tmp file.
func (*DiskBufferReader) Read ¶
func (dbr *DiskBufferReader) Read(out []byte) (int, error)
Read from the len(out) bytes from the reader starting at the current index.
func (*DiskBufferReader) ReadAt ¶ added in v0.1.4
func (dbr *DiskBufferReader) ReadAt(out []byte, offset int64) (int, error)
ReadAt reads len(p) bytes into p starting at offset off in the underlying input source.
func (*DiskBufferReader) Reset ¶
func (dbr *DiskBufferReader) Reset() error
Reset the reader position to the start.
func (*DiskBufferReader) Seek ¶ added in v0.1.4
func (dbr *DiskBufferReader) Seek(offset int64, whence int) (int64, error)
Seek sets the offset for the next Read or Write to offset.
func (*DiskBufferReader) Stop ¶
func (dbr *DiskBufferReader) Stop()
Stop storing the read bytes in the tmp file.