©
このドキュメントでは、 php中国語ネットマニュアル リリース
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
Reader是一个引用可打印的解码器。
type Reader struct { // contains filtered or unexported fields}
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 (r *Reader) Read(p []byte) (n int, err error)
读取并解读来自底层读取器的引用可打印数据。
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(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 (w *Writer) Close() error
关闭Writer,将任何未写入的数据刷新到基础io.Writer,但不关闭基础io.Writer。
func (w *Writer) Write(p []byte) (n int, err error)
使用quoted-printable编码编码p,并将其写入底层的io.Writer。它将行长限制为76个字符。编码字节不必刷新,直到Writer关闭。