Documentation ¶
Index ¶
- Variables
- func GetBytes(length, capacity int) []byte
- func GetBytesWithLen(length int) []byte
- func PutBytes(buf []byte)
- func PutBytesStream(bytesStream <-chan []byte)
- func SetMemoryLimit(n int64)
- type FrameBuffer
- type StringsBuffer
- func (s *StringsBuffer) Close()
- func (s *StringsBuffer) Export() []string
- func (s *StringsBuffer) ExportTo(result []string) int
- func (s *StringsBuffer) Len() int
- func (s *StringsBuffer) NewElem()
- func (s *StringsBuffer) NewEmptyResult() []string
- func (s *StringsBuffer) TruncateElem(n int)
- func (s *StringsBuffer) Write(p []byte) (int, error)
- func (s *StringsBuffer) WriteByte(p byte) error
- func (s *StringsBuffer) WriteString(p string) (int, error)
- type ZBuffer
- func (z *ZBuffer) Close() error
- func (z *ZBuffer) Flush() error
- func (z *ZBuffer) Read(des []byte) (int, error)
- func (z *ZBuffer) ReadByte() (byte, error)
- func (z *ZBuffer) ReadFrom(r io.Reader) (int64, error)
- func (z *ZBuffer) Write(src []byte) (int, error)
- func (z *ZBuffer) WriteByte(b byte) error
- func (z *ZBuffer) WriteTo(w io.Writer) (int64, error)
- type ZReader
- func (z *ZReader) Close() error
- func (z *ZReader) PrependCurrentBuffer(pre []byte)
- func (z *ZReader) Read(p []byte) (int, error)
- func (z *ZReader) ReadByte() (byte, error)
- func (z *ZReader) ReadFull(p []byte) error
- func (z *ZReader) ReadNextBuffer() ([]byte, error)
- func (z *ZReader) ReadUvarint() (uint64, error)
- func (z *ZReader) UnreadCurrentBuffer(n int)
- type ZWriter
Constants ¶
This section is empty.
Variables ¶
var (
MemoryLimit int64 = 1024 * 1024 * 1024
)
Functions ¶
func GetBytes ¶
GetBytes gets a buffer with at least of capacity as defined by caller. panics with negative value
func GetBytesWithLen ¶
func PutBytesStream ¶
func PutBytesStream(bytesStream <-chan []byte)
func SetMemoryLimit ¶
func SetMemoryLimit(n int64)
Types ¶
type FrameBuffer ¶
type FrameBuffer struct { *StringsBuffer // contains filtered or unexported fields }
func NewFrameBuffer ¶
func NewFrameBuffer() *FrameBuffer
func (*FrameBuffer) DiscardCurrentRow ¶
func (f *FrameBuffer) DiscardCurrentRow()
DiscardCurrentRow unreads data after last NextRow is called
func (*FrameBuffer) Export ¶
func (f *FrameBuffer) Export(result [][]string) (int, []int)
Export attempts to put the result into 2 dimensional string. returns the number of rows read and each number of elems in each row
func (*FrameBuffer) NewRow ¶
func (f *FrameBuffer) NewRow()
func (*FrameBuffer) ReadColumnTexts ¶
func (f *FrameBuffer) ReadColumnTexts(columnTexts [][]string) (int, []int)
ReadColumnTexts attempts to read into ReadColumnTexts May skip columns or panic if dimension are not correct Caller should check the size of input before calling this function return number of rows read and number of elems read in each row
type StringsBuffer ¶
type StringsBuffer struct {
// contains filtered or unexported fields
}
func NewStringsBuffer ¶
func NewStringsBuffer() *StringsBuffer
func (*StringsBuffer) Close ¶
func (s *StringsBuffer) Close()
func (*StringsBuffer) Export ¶
func (s *StringsBuffer) Export() []string
Export return the current state of the StringsBuffer, safe to use until the next write or close operation
func (*StringsBuffer) ExportTo ¶
func (s *StringsBuffer) ExportTo(result []string) int
ExportTo attempts to put the
func (*StringsBuffer) Len ¶
func (s *StringsBuffer) Len() int
func (*StringsBuffer) NewElem ¶
func (s *StringsBuffer) NewElem()
NewElem starts a new section to write another string
func (*StringsBuffer) NewEmptyResult ¶
func (s *StringsBuffer) NewEmptyResult() []string
NewEmptyResult returns an empty slice of string, which guarantees that when used as argument to call Export, will always export all data in the buffer
func (*StringsBuffer) TruncateElem ¶
func (s *StringsBuffer) TruncateElem(n int)
TruncateElem discard all but first n strings panics if there
func (*StringsBuffer) WriteByte ¶
func (s *StringsBuffer) WriteByte(p byte) error
func (*StringsBuffer) WriteString ¶
func (s *StringsBuffer) WriteString(p string) (int, error)
type ZBuffer ¶
type ZBuffer struct {
// contains filtered or unexported fields
}
ZBuffer attempts to reuse all byte bufferStream without wastage, aims to have zero []byte being garbage collected.
func NewZBuffer ¶
NewZBuffer returns a *ZBuffer with given fixed buffer size and max buffer count
func NewZBufferDefault ¶
func NewZBufferDefault() *ZBuffer
func (*ZBuffer) Close ¶
Close cleaned up the buffer, any operations after calling close will not be safe
func (*ZBuffer) Read ¶
Read transfer content to des, draining the buffer. If buffer is completely drained, io.EOF is returned
func (*ZBuffer) ReadByte ¶
ReadByte reads 1 byte from buffer If buffer is drained, io.EOF is returned
func (*ZBuffer) ReadFrom ¶
ReadFrom reads from r until io.EOF or error, expands the buffer when needed
func (*ZBuffer) Write ¶
Write appends contents of src to buffer, increase the size of buffer when needed. Blocks if buffer is full.
type ZReader ¶
type ZReader struct {
// contains filtered or unexported fields
}
func NewZReaderDefault ¶
func (*ZReader) PrependCurrentBuffer ¶
func (*ZReader) ReadNextBuffer ¶
ReadNextBuffer returns the remaining buffer if not empty, else attempts to read from the next buffer in channel
func (*ZReader) ReadUvarint ¶
func (*ZReader) UnreadCurrentBuffer ¶
type ZWriter ¶
type ZWriter struct {
// contains filtered or unexported fields
}