package buffer
import "github.com/Azure/go-amqp/internal/buffer"
Index ¶
- type Buffer
- func New(b []byte) *Buffer
- func (b *Buffer) Append(p []byte)
- func (b *Buffer) AppendByte(bb byte)
- func (b *Buffer) AppendString(s string)
- func (b *Buffer) AppendUint16(n uint16)
- func (b *Buffer) AppendUint32(n uint32)
- func (b *Buffer) AppendUint64(n uint64)
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Detach() []byte
- func (b *Buffer) Len() int
- func (b *Buffer) Next(n int64) ([]byte, bool)
- func (b *Buffer) PeekByte() (byte, error)
- func (b *Buffer) ReadByte() (byte, error)
- func (b *Buffer) ReadFromOnce(r io.Reader) error
- func (b *Buffer) ReadUint16() (uint16, error)
- func (b *Buffer) ReadUint32() (uint32, error)
- func (b *Buffer) ReadUint64() (uint64, error)
- func (b *Buffer) Reclaim()
- func (b *Buffer) Reset()
- func (b *Buffer) Size() int
- func (b *Buffer) Skip(n int)
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is similar to bytes.Buffer but specialized for this module. The zero-value is an empty buffer ready for use.
func New ¶
New creates a new Buffer with b as its initial contents. Use this to start reading from b.
func (*Buffer) Append ¶
Append appends p to the existing buffer.
func (*Buffer) AppendByte ¶
AppendByte appends bb to the existing buffer.
func (*Buffer) AppendString ¶
AppendString appends s to the existing buffer.
func (*Buffer) AppendUint16 ¶
AppendUint16 appends n as two bytes in big-endian encoding.
func (*Buffer) AppendUint32 ¶
AppendUint32 appends n as four bytes in big-endian encoding.
func (*Buffer) AppendUint64 ¶
AppendUint64 appends n as eight bytes in big-endian encoding.
func (*Buffer) Bytes ¶
Bytes returns a slice containing the unread portion of the buffer.
func (*Buffer) Detach ¶
Detach returns the underlying byte slice, disassociating it from the buffer.
func (*Buffer) Len ¶
Len returns the number of bytes of the unread portion of the buffer.
func (*Buffer) Next ¶
Next returns a slice containing the next n bytes from the buffer and advances the buffer. If there are fewer than n bytes in the buffer, Next returns the remaining contents, false. The slice is only valid until the next call to a read or write method.
func (*Buffer) PeekByte ¶
PeekByte returns the next byte in the buffer without advancing the buffer. If there are insufficient bytes, an error is returned.
func (*Buffer) ReadByte ¶
ReadByte reads one byte from the buffer and advances the buffer. If there are insufficient bytes, an error is returned.
func (*Buffer) ReadFromOnce ¶
ReadFromOnce reads from r to populate the buffer. Reads up to cap - len of the underlying slice.
func (*Buffer) ReadUint16 ¶
ReadUint16 reads two bytes from the buffer and decodes them as big-endian into a uint16. Advances the buffer by two. If there are insufficient bytes, an error is returned.
func (*Buffer) ReadUint32 ¶
ReadUint32 reads four bytes from the buffer and decodes them as big-endian into a uint32. Advances the buffer by four. If there are insufficient bytes, an error is returned.
func (*Buffer) ReadUint64 ¶
ReadUint64 reads eight bytes from the buffer and decodes them as big-endian into a uint64. Advances the buffer by eight. If there are insufficient bytes, an error is returned.
func (*Buffer) Reclaim ¶
func (b *Buffer) Reclaim()
Reclaim moves the unread portion of the buffer to the beginning of the underlying slice and resets the index.
func (*Buffer) Reset ¶
func (b *Buffer) Reset()
Reset resets the buffer to be empty but retains the underlying storage for use by future writes.
func (*Buffer) Size ¶
Size returns the number of bytes that have been read from this buffer. This implies a minimum size of the underlying buffer.
func (*Buffer) Skip ¶
Skip advances the buffer by n bytes.
Source Files ¶
- Version
- v1.4.0 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 5 days ago –
Tools for package owners.