quotedprintable

Imports

Imports #

"bufio"
"bytes"
"fmt"
"io"
"io"

Constants & Variables

crlf var #

var crlf = *ast.CallExpr

lf var #

var lf = *ast.CallExpr

lineMaxLen const #

const lineMaxLen = 76

softSuffix var #

var softSuffix = *ast.CallExpr

upperhex const #

const upperhex = "0123456789ABCDEF"

Structs

Reader struct #

Reader is a quoted-printable decoder.

type Reader struct {
br *bufio.Reader
rerr error
line []byte
}

Writer struct #

A Writer is a quoted-printable writer that implements [io.WriteCloser].

type Writer struct {
Binary bool
w io.Writer
i int
line [78]byte
cr bool
}

Functions

Close method #

Close closes the [Writer], flushing any unwritten data to the underlying [io.Writer], but does not close the underlying io.Writer.

func (w *Writer) Close() error

NewReader function #

NewReader returns a quoted-printable reader, decoding from r.

func NewReader(r io.Reader) *Reader

NewWriter function #

NewWriter returns a new [Writer] that writes to w.

func NewWriter(w io.Writer) *Writer

Read method #

Read reads and decodes quoted-printable data from the underlying reader.

func (r *Reader) Read(p []byte) (n int, err error)

Write method #

Write encodes p using quoted-printable encoding and writes it to the underlying [io.Writer]. It limits line length to 76 characters. The encoded bytes are not necessarily flushed until the [Writer] is closed.

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

checkLastByte method #

checkLastByte encodes the last buffered byte if it is a space or a tab.

func (w *Writer) checkLastByte() error

encode method #

func (w *Writer) encode(b byte) error

flush method #

func (w *Writer) flush() error

fromHex function #

func fromHex(b byte) (byte, error)

insertCRLF method #

func (w *Writer) insertCRLF() error

insertSoftLineBreak method #

func (w *Writer) insertSoftLineBreak() error

isQPDiscardWhitespace function #

func isQPDiscardWhitespace(r rune) bool

isWhitespace function #

func isWhitespace(b byte) bool

readHexByte function #

func readHexByte(v []byte) (b byte, err error)

write method #

write limits text encoded in quoted-printable to 76 characters per line.

func (w *Writer) write(p []byte) error

Generated with Arrow