bufferwriter

package
v3.80.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bufferwriter provides a contentWriter implementation using a shared buffer pool for memory management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferWriter

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

BufferWriter implements contentWriter, using a shared buffer pool for memory management.

func New

func New() *BufferWriter

New creates a new instance of BufferWriter.

func (*BufferWriter) CloseForWriting

func (b *BufferWriter) CloseForWriting() error

CloseForWriting is a no-op for buffer, as there is no resource cleanup needed for bytes.Buffer.

func (*BufferWriter) Len

func (b *BufferWriter) Len() int

Len returns the length of the buffer's content.

func (*BufferWriter) ReadCloser

func (b *BufferWriter) ReadCloser() (io.ReadCloser, error)

ReadCloser provides a read-closer for the buffer's content. It wraps the buffer's content in a NopCloser to provide a ReadCloser without additional closing behavior, as closing a bytes.Buffer is a no-op.

func (*BufferWriter) String

func (b *BufferWriter) String() (string, error)

String returns the buffer's content as a string.

func (*BufferWriter) Write

func (b *BufferWriter) Write(data []byte) (int, error)

Write delegates the writing operation to the underlying bytes.Buffer.

Jump to

Keyboard shortcuts

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