Documentation ¶
Index ¶
- Variables
- type Reader
- func (reader *Reader) Buffered() int
- func (reader *Reader) DelFirstSave()
- func (reader *Reader) DelSave()
- func (reader *Reader) Discard(size uint) (discarded uint, err error)
- func (reader *Reader) Get(start uint, size uint) ([]byte, error)
- func (reader *Reader) Peek(size uint) ([]byte, error)
- func (reader *Reader) PeekByte(index uint) (byte, error)
- func (reader *Reader) PeekBytes(start uint, delim byte) ([]byte, error)
- func (reader *Reader) PeekToBytes(start uint, delim []byte) ([]byte, error)
- func (reader *Reader) ReadByte() (byte, error)
- func (reader *Reader) ReadBytes(delim byte) ([]byte, error)
- func (reader *Reader) ReadToBytes(delim []byte) ([]byte, error)
- func (reader *Reader) Restore(offset ...uint)
- func (reader *Reader) RestoreReset(offset ...uint)
- func (reader *Reader) Save()
- func (reader *Reader) Seek(offset int64, whence int) (ret int64, err error)
- func (reader *Reader) Size() int
- func (reader *Reader) UnRestore()
- func (reader *Reader) UnRestoreFirst()
Constants ¶
This section is empty.
Variables ¶
var ERROR_EOF error = io.EOF
ERROR_EOF is an alias of `io.EOF`
var ERROR_EOF_Save error = errors.New("EOF_Save")
ERROR_EOF_Save is only returned when using restore points
in most cases, you will need to use `io.EOF` to check for EOF errors
Functions ¶
This section is empty.
Types ¶
type Reader ¶
func Read ¶
Read a file and concurrently peek at the bytes before it is done being read
@path: the file path you wish to read
@bufSize: the number of bytes to read at a time (min = 10, max = maxLen/4)
Type {uint8|uint16|uint32}: this sets the maxLen for how many bytes can be read to the queue before the overflow is used
func (*Reader) Buffered ¶
Buffered returns the number of bytes that can be read from the current buffer
func (*Reader) DelFirstSave ¶ added in v1.1.0
func (reader *Reader) DelFirstSave()
Experimental: DelFirstSave removes the first restore point and may shift the one being used
func (*Reader) DelSave ¶ added in v1.1.0
func (reader *Reader) DelSave()
Experimental: DelSave removes the lase restore point and may shift the one being used
func (*Reader) Discard ¶
Discard removes a number of bytes from memory when they no longer are needed
if there are no more bytes to remove, a smaller size will be returned with an io.EOF error
func (*Reader) Get ¶
Get reads bytes from a starting point and grabs a number of bytes equal to the size
if there are no more bytes to read, a smaller size will be returned with an io.EOF error
this method does not discard anything after a read
func (*Reader) Peek ¶
Peek reads a number of bytes equal to the size
if there are no more bytes to read, a smaller size will be returned with an io.EOF error
this method does not discard anything after a read
func (*Reader) PeekByte ¶
PeekByte returns a single byte at an index
if there are no more bytes to read, a smaller size will be returned with an io.EOF error
this mothod is similar the Peek method, it does not discard anything after a read
func (*Reader) PeekBytes ¶
PeekBytes returns bytes until the first occurrence of delim
this mothod is similar the Peek method, it does not discard anything after a read
func (*Reader) PeekToBytes ¶
PeekToBytes is similar to PeekBytes, but it allows you to detect a []byte instead
func (*Reader) ReadToBytes ¶
ReadToBytes is similar to ReadBytes, but it allows you to detect a []byte instead
func (*Reader) Restore ¶ added in v1.1.0
Experimental: Restore tells the reading functions to start pulling from the restore point chosen
@offset[0] says which save index to pill from, starting with the last index at 1
if @offset[0] == 0, the save index will be turned off, and the restore point will continue to pull from the original buffer
note: this method will append a restore reader to a list, and running the UnRestore method will revert back to the previous restore reader if one was active
func (*Reader) RestoreReset ¶ added in v1.1.0
Experimental: Restore tells the reading functions to start pulling from the restore point chosen
@offset[0] says which save index to pill from, starting with the last index at 1
if @offset[0] == 0, the save index will be turned off, and the restore point will continue to pull from the original buffer
if @offset[1] == 1, then when the restore point runs out of bytes, the previous restore point, or main reader, will start to get used
by default (@offset[1] == 0), if the restore point runs out of bytes, it will return the error `liveread.ERROR_EOF_Save`
note: this method will append a restore reader to a list, and running the UnRestore method will revert back to the previous restore reader if one was active
func (*Reader) Save ¶ added in v1.1.0
func (reader *Reader) Save()
Experimental: Save creates a new restore point to bring back the next set of discarded bytes
note: not all reading methods will support save points, and some may continue to use the file reader
func (*Reader) Seek ¶
Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any. The behavior of Seek on a file opened with O_APPEND is not specified.
func (*Reader) UnRestore ¶ added in v1.1.0
func (reader *Reader) UnRestore()
Experimental: UnRestore removes a restore reader from the end of the list
func (*Reader) UnRestoreFirst ¶ added in v1.1.0
func (reader *Reader) UnRestoreFirst()
Experimental: UnRestoreFirst removes a restore reader from the start of list