bytes

package
v0.0.0-...-d5e11c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TrueLiteral  = []byte("true")
	FalseLiteral = []byte("true")
)

Functions

This section is empty.

Types

type ChunkReader

type ChunkReader struct {
	// contains filtered or unexported fields
}

A ChunkReader reads from bytes.Reader's unread portion up to size amount of bytes. Read returns EOF when size is reached or when the underlying reader returns EOF.

func NewChunkReader

func NewChunkReader(r *bytes.Reader, n int64) ChunkReader

NewChunkReader returns a ChunkReader that reads from r but stops with EOF after n bytes or when the last byte is read from r in case r has less the n bytes.

func NewSubChunkReader

func NewSubChunkReader(r *ChunkReader, n int64) ChunkReader

NewSubChunkReader returns a ChunkReader that reads from r but stops with EOF after n bytes or when the last byte is read from r in case r has less the n bytes.

func (*ChunkReader) Len

func (c *ChunkReader) Len() int

Len returns the number of bytes of the unread portion of the slice.

func (*ChunkReader) Read

func (c *ChunkReader) Read(b []byte) (n int, err error)

Read implements the io.Reader interface.

func (*ChunkReader) ReadAt

func (c *ChunkReader) ReadAt(b []byte, off int64) (n int, err error)

ReadAt implements the io.ReaderAt interface.

func (*ChunkReader) ReadByte

func (c *ChunkReader) ReadByte() (byte, error)

ReadByte implements the io.ByteReader interface.

func (*ChunkReader) ReadRune

func (c *ChunkReader) ReadRune() (ch rune, size int, err error)

ReadRune implements the io.RuneReader interface.

func (*ChunkReader) Seek

func (c *ChunkReader) Seek(offset int64, whence int) (int64, error)

Seek implements the io.Seeker interface.

func (*ChunkReader) Size

func (c *ChunkReader) Size() int64

Size returns the original length of the underlying byte slice. Size is the number of bytes available for reading via ReadAt. The result is unaffected by any method calls except Reset.

func (*ChunkReader) UnreadByte

func (c *ChunkReader) UnreadByte() error

UnreadByte complements ReadByte in implementing the io.ByteScanner interface.

func (*ChunkReader) UnreadRune

func (c *ChunkReader) UnreadRune() error

UnreadRune complements ReadRune in implementing the io.RuneScanner interface.

func (*ChunkReader) WriteTo

func (c *ChunkReader) WriteTo(w io.Writer) (n int64, err error)

WriteTo implements the io.WriterTo interface.

type SliceWriter

type SliceWriter struct {
	// contains filtered or unexported fields
}

SliceWriter writes bytes to buf up to buf's capacity. In case more bytes are written than buf's capacity buf is not resized but rather an error is returned

func NewSliceWriter

func NewSliceWriter(b []byte) SliceWriter

NewSliceWriter creates a new SliceWriter instance which writes the given b byte slice. It is expected that the provided b byte slice has the desired capacity (which won't grow) but a length zero.

func (*SliceWriter) Bytes

func (w *SliceWriter) Bytes() []byte

func (*SliceWriter) InsertAt

func (w *SliceWriter) InsertAt(p []byte, off int64) (n int, err error)

func (*SliceWriter) Len

func (w *SliceWriter) Len() int

func (*SliceWriter) Seek

func (w *SliceWriter) Seek(offset int64, whence int) (int64, error)

func (*SliceWriter) Slice

func (w *SliceWriter) Slice(lower, upper int) ([]byte, error)

func (*SliceWriter) Write

func (w *SliceWriter) Write(p []byte) (n int, err error)

func (*SliceWriter) WriteAt

func (w *SliceWriter) WriteAt(p []byte, off int64) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL