目录搜索
archivearchive/tararchive/zipbufiobufio(缓存)builtinbuiltin(内置包)bytesbytes(包字节)compresscompress/bzip2(压缩/bzip2)compress/flate(压缩/flate)compress/gzip(压缩/gzip)compress/lzw(压缩/lzw)compress/zlib(压缩/zlib)containercontainer/heap(容器数据结构heap)container/list(容器数据结构list)container/ring(容器数据结构ring)contextcontext(上下文)cryptocrypto(加密)crypto/aes(加密/aes)crypto/cipher(加密/cipher)crypto/des(加密/des)crypto/dsa(加密/dsa)crypto/ecdsa(加密/ecdsa)crypto/elliptic(加密/elliptic)crypto/hmac(加密/hmac)crypto/md5(加密/md5)crypto/rand(加密/rand)crypto/rc4(加密/rc4)crypto/rsa(加密/rsa)crypto/sha1(加密/sha1)crypto/sha256(加密/sha256)crypto/sha512(加密/sha512)crypto/subtle(加密/subtle)crypto/tls(加密/tls)crypto/x509(加密/x509)crypto/x509/pkix(加密/x509/pkix)databasedatabase/sql(数据库/sql)database/sql/driver(数据库/sql/driver)debugdebug/dwarf(调试/dwarf)debug/elf(调试/elf)debug/gosym(调试/gosym)debug/macho(调试/macho)debug/pe(调试/pe)debug/plan9obj(调试/plan9obj)encodingencoding(编码)encoding/ascii85(编码/ascii85)encoding/asn1(编码/asn1)encoding/base32(编码/base32)encoding/base64(编码/base64)encoding/binary(编码/binary)encoding/csv(编码/csv)encoding/gob(编码/gob)encoding/hex(编码/hex)encoding/json(编码/json)encoding/pem(编码/pem)encoding/xml(编码/xml)errorserrors(错误)expvarexpvarflagflag(命令行参数解析flag包)fmtfmtgogo/ast(抽象语法树)go/buildgo/constant(常量)go/doc(文档)go/format(格式)go/importergo/parsergo/printergo/scanner(扫描仪)go/token(令牌)go/types(类型)hashhash(散列)hash/adler32hash/crc32hash/crc64hash/fnvhtmlhtmlhtml/template(模板)imageimage(图像)image/color(颜色)image/color/palette(调色板)image/draw(绘图)image/gifimage/jpegimage/pngindexindex/suffixarrayioioio/ioutillogloglog/syslog(日志系统)mathmathmath/bigmath/bigmath/bitsmath/bitsmath/cmplxmath/cmplxmath/randmath/randmimemimemime/multipart(多部分)mime/quotedprintablenetnetnet/httpnet/httpnet/http/cginet/http/cookiejarnet/http/fcginet/http/httptestnet/http/httptracenet/http/httputilnet/http/internalnet/http/pprofnet/mailnet/mailnet/rpcnet/rpcnet/rpc/jsonrpcnet/smtpnet/smtpnet/textprotonet/textprotonet/urlnet/urlososos/execos/signalos/userpathpathpath/filepath(文件路径)pluginplugin(插件)reflectreflect(反射)regexpregexp(正则表达式)regexp/syntaxruntimeruntime(运行时)runtime/debug(调试)runtime/internal/sysruntime/pprofruntime/race(竞争)runtime/trace(执行追踪器)sortsort(排序算法)strconvstrconv(转换)stringsstrings(字符串)syncsync(同步)sync/atomic(原子操作)syscallsyscall(系统调用)testingtesting(测试)testing/iotesttesting/quicktexttext/scanner(扫描文本)text/tabwritertext/template(定义模板)text/template/parsetimetime(时间戳)unicodeunicodeunicode/utf16unicode/utf8unsafeunsafe
文字

  • import "mime/quotedprintable"

  • 概述

  • 索引

  • 例子

概述

Package quotedprintable实现RFC 2045规定的带引号的可打印编码。

索引

  • type Reader

  • func NewReader(r io.Reader) *Reader

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

  • type Writer

  • func NewWriter(w io.Writer) *Writer

  • func (w *Writer) Close() error

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

例子

NewReader NewWriter

文件包

reader.go writer.go

type Reader

Reader是一个引用可打印的解码器。

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

func NewReader

func NewReader(r io.Reader) *Reader

NewReader返回一个带引号的可打印阅读器,从r进行解码。

package mainimport ("fmt""io/ioutil""mime/quotedprintable""strings")func main() {for _, s := range []string{`=48=65=6C=6C=6F=2C=20=47=6F=70=68=65=72=73=21`,`invalid escape: <b style="font-size: 200%">hello</b>`,"Hello, Gophers! This symbol will be unescaped: =3D and this will be written in =\r\none line.",} {
		b, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(s)))
		fmt.Printf("%s %v\n", b, err)}}

func (*Reader) Read

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

读取并解读来自底层读取器的引用可打印数据。

type Writer

Writer是一个引用可打印的作家,它实现了io.WriteCloser。

type Writer struct {        // Binary mode treats the writer's input as pure binary and processes end of        // line bytes as binary data.
        Binary bool        // contains filtered or unexported fields}

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter返回一个写入w的新Writer。

package mainimport ("mime/quotedprintable""os")func main() {
	w := quotedprintable.NewWriter(os.Stdout)
	w.Write([]byte("These symbols will be escaped: = \t"))
	w.Close()}

func (*Writer) Close

func (w *Writer) Close() error

关闭Writer,将任何未写入的数据刷新到基础io.Writer,但不关闭基础io.Writer。

func (*Writer) Write

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

使用quoted-printable编码编码p,并将其写入底层的io.Writer。它将行长限制为76个字符。编码字节不必刷新,直到Writer关闭。

上一篇:下一篇: