# README
サンプルリスト
このディレクトリには以下のサンプルがあります。
file | example name | note |
---|---|---|
limitread.go | ioop_limit_read | io.LimitedReader のサンプルです. |
onebyteread.go | ioop_onebyte_read | 1バイトずつ読み出す io.LimitedReader のサンプルです. |
multiwrite.go | ioop_multiwrite | io.MultiWriterを利用してgzip圧縮しながらCRCチェックサムも算出するサンプルです. |
multiread.go | ioop_multiread | io.MultiReaderを利用して複数のファイルを一気に読み込むサンプルです。 |
teeread.go | ioop_tee_read | io.TeeReader を利用したサンプルです。 |
sectionread.go | ioop_section_read | io.SectionReader を利用したサンプルです。 |
offsetwrite.go | ioop_offset_write | io.OffsetWriter を利用したサンプルです。 |
# Functions
LimitRead は、io.LimitedReader のサンプルです.
MultiRead は、io.MultiReaderを利用して複数のファイルを一気に読み込むサンプルです。
> MultiReader returns a Reader that's the logical concatenation of the provided input readers.
MultiWrite は、io.MultiWriterを利用してgzip圧縮しながらCRCチェックサムも算出するサンプルです.
NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。.
OffsetWrite は、io.OffsetWriter を利用したサンプルです。
io.OffsetWriter は、io.WriterAt インターフェースを実装しているものを要求する。
os.File が io.WriterAt を実装している。
# REFERENCES - https://pkg.go.dev/[email protected]#OffsetWriter - https://cs.opensource.google/go/go/+/go1.22.2:src/io/io.go;l=570.
OneByteRead は、1バイトずつ読み出す io.LimitedReader のサンプルです.
SectionRead は、io.SectionReader を利用したサンプルです。
io.SectionReader は、指定した範囲のデータを読み込んでくれる特殊ストリーム。
> SectionReader implements Read, Seek, and ReadAt on a section of an underlying ReaderAt.
TeeRead は、io.TeeReader を利用したサンプルです。
io.TeeReader は、teeコマンドと同じような動きをする。読み取ったデータは戻り値のReaderを経由して取得し、さらに引数で指定したio.Writerにも書き込まれる。
> TeeReader returns a Reader that writes to w what it reads from r.