github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/archive/zip/register.go (about) 1 // Copyright 2010 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 zip 6 7 import ( 8 "github.com/shogo82148/std/io" 9 ) 10 11 // Compressor は、w に書き込む新しい圧縮ライターを返します。 12 // WriteCloser の Close メソッドは、保留中のデータを w にフラッシュするために使用する必要があります。 13 // Compressor 自体は、複数のゴルーチンから同時に呼び出されることができますが、 14 // 各返されたライターは一度に1つのゴルーチンによってのみ使用されます。 15 type Compressor func(w io.Writer) (io.WriteCloser, error) 16 17 // Decompressor は、r から読み取る新しい解凍リーダーを返します。 18 // [io.ReadCloser] の Close メソッドは、関連するリソースを解放するために使用する必要があります。 19 // Decompressor 自体は、複数のゴルーチンから同時に呼び出されることができますが、 20 // 各返されたリーダーは一度に1つのゴルーチンによってのみ使用されます。 21 type Decompressor func(r io.Reader) io.ReadCloser 22 23 // RegisterDecompressor は、特定のメソッド ID にカスタムの解凍プログラムを登録または上書きします。 24 // メソッドの解凍プログラムが見つからない場合、Writer はパッケージレベルで解凍プログラムを検索します。 25 // 一般的なメソッド [Store] と [Deflate] は組み込みです。 26 func RegisterDecompressor(method uint16, dcomp Decompressor) 27 28 // RegisterCompressor は、特定のメソッド ID にカスタムの圧縮プログラムを登録または上書きします。 29 // 一般的なメソッド [Store] と [Deflate] は組み込みです。 30 func RegisterCompressor(method uint16, comp Compressor)