github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/mime/quotedprintable/writer.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package quotedprintable
     6  
     7  import "github.com/shogo82148/std/io"
     8  
     9  // Writerは、[io.WriteCloser] を実装するquoted-printableライターです。
    10  type Writer struct {
    11  	// バイナリモードでは、ライターの入力を純粋なバイナリとして扱い、
    12  	// 行末のバイトをバイナリデータとして処理します。
    13  	Binary bool
    14  
    15  	w    io.Writer
    16  	i    int
    17  	line [78]byte
    18  	cr   bool
    19  }
    20  
    21  // NewWriterは、wに書き込む新しい [Writer] を返します。
    22  func NewWriter(w io.Writer) *Writer
    23  
    24  // Writeは、pをquoted-printableエンコーディングでエンコードし、それを
    25  // 基礎となる [io.Writer] に書き込みます。行の長さは76文字に制限されます。
    26  // エンコードされたバイトは、[Writer] が閉じられるまで必ずしもフラッシュされません。
    27  func (w *Writer) Write(p []byte) (n int, err error)
    28  
    29  // Closeは [Writer] を閉じ、未書き込みのデータを基礎となる [io.Writer] にフラッシュしますが、
    30  // 基礎となるio.Writerを閉じるわけではありません。
    31  func (w *Writer) Close() error