base64

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

Encoder is a streaming encoder for base64 strings. It must be initialized with Init.

The code has been adapted from the standard library encoder that is returned by base64.NewEncoder. The main differences are that Init allows for an Encoder value to be initialized directly and that it writes to an internal strings.Builder instead of an io.Writer. Both allow streaming encoding without extra allocations. Writes to a strings.Builder never fail, so error handling has been removed for simplification.

func (*Encoder) Init

func (e *Encoder) Init(enc *base64.Encoding)

Init initializes an Encoder with the given base64.Encoding.

func (*Encoder) String

func (e *Encoder) String() (s string)

String flushes any pending output from the encoder and returns the encoded string. The Encoder is reset to its initial state so it can be reused.

func (*Encoder) Write

func (e *Encoder) Write(p []byte)

Write encodes p in an internal buffer.

Jump to

Keyboard shortcuts

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