v0.1.3-0...-08ec195 Latest Latest

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

Go to latest
Published: Jul 12, 2018 License: BSD-4-Clause Imports: 5 Imported by: 0




This section is empty.


This section is empty.


func PutAtoBuffer

func PutAtoBuffer(buf AtomicBuffers)

PutBuffer returns a atomicBuffer to the pool


type AtomicBuffers

type AtomicBuffers interface {
	Bytes() []byte
	Cap() int
	Len() int
	Next(int) []byte
	ReadByte() (byte, error)
	ReadBytes(byte) ([]byte, error)
	ReadFrom(io.Reader) (int64, error)
	ReadRune() (rune, int, error)
	ReadString(byte) (string, error)
	UnreadByte() error
	UnreadRune() error
	WriteByte(byte) error
	WriteRune(rune) (int, error)
	WriteString(string) (int, error)
	WriteTo(io.Writer) (int64, error)
	Read([]byte) (int, error)
	Write([]byte) (int, error)
	String() string

func GetAtoBuffer

func GetAtoBuffer() AtomicBuffers

GetBuffer fetches a atomicBuffer from the pool

type ByteBuffer

type ByteBuffer struct {
	// B is a byte buffer to use in append-like workloads.
	// See example code for details.
	B []byte

ByteBuffer provides byte buffer, which can be used with fasthttp API in order to minimize memory allocations.

ByteBuffer may be used with functions appending data to the given []byte slice. See example code for details.

Use AcquireByteBuffer for obtaining an empty byte buffer.

func (*ByteBuffer) Len

func (b *ByteBuffer) Len() int

Len returns the number of accumulated bytes; b.Len() == len(b.String()).

func (*ByteBuffer) Reset

func (b *ByteBuffer) Reset()

Reset makes ByteBuffer.B empty.

func (*ByteBuffer) Set

func (b *ByteBuffer) Set(p []byte)

Set sets ByteBuffer.B to p

func (*ByteBuffer) SetString

func (b *ByteBuffer) SetString(s string)

SetString sets ByteBuffer.B to s

func (*ByteBuffer) String

func (b *ByteBuffer) String() string

String returns the accumulated string.

func (*ByteBuffer) Write

func (b *ByteBuffer) Write(p []byte) (int, error)

Write implements io.Writer - it appends p to ByteBuffer.B

func (*ByteBuffer) WriteByte

func (b *ByteBuffer) WriteByte(c byte) error

func (*ByteBuffer) WriteRune

func (b *ByteBuffer) WriteRune(r rune) (n int, err error)

(r rune) (n int, err error) { WriteString appends s to ByteBuffer.B

func (*ByteBuffer) WriteString

func (b *ByteBuffer) WriteString(s string) (int, error)

WriteString appends s to ByteBuffer.B

type ByteBufferPool

type ByteBufferPool struct {
	// contains filtered or unexported fields

func (*ByteBufferPool) Acquire

func (p *ByteBufferPool) Acquire() *ByteBuffer

func (*ByteBufferPool) Release

func (p *ByteBufferPool) Release(b *ByteBuffer)

Jump to

Keyboard shortcuts

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