github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/compress/flate/deflate.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package flate 4 5 import ( 6 compress ".." 7 "../../mediatype" 8 "../../protocol" 9 ) 10 11 const ( 12 ContentEncoding = "deflate" 13 Extension = "zz" 14 ) 15 16 var Deflate = deflate{ 17 CompressType: compress.New(ContentEncoding, mediatype.New("domain/deflate.protocol.data-structure").SetFileExtension(Extension)), 18 } 19 20 type deflate struct { 21 *compress.CompressType 22 } 23 24 func (d *deflate) Compress(raw protocol.Codec, options protocol.CompressOptions) (compressed protocol.Codec, err protocol.Error) { 25 compressed = &Compressor{ 26 source: raw, 27 options: options, 28 } 29 return 30 } 31 func (d *deflate) CompressBySlice(raw []byte, options protocol.CompressOptions) (compressed protocol.Codec, err protocol.Error) { 32 // TODO::: 33 return 34 } 35 func (d *deflate) CompressByReader(raw protocol.Reader, options protocol.CompressOptions) (compressed protocol.Codec, err protocol.Error) { 36 // TODO::: 37 return 38 } 39 40 func (d *deflate) Decompress(compressed protocol.Codec) (raw protocol.Codec, err protocol.Error) { 41 raw = &Decompressor{ 42 source: compressed, 43 } 44 return 45 } 46 func (d *deflate) DecompressFromSlice(compressed []byte) (raw protocol.Codec, err protocol.Error) { 47 // TODO::: 48 return 49 } 50 func (d *deflate) DecompressFromReader(compressed protocol.Reader, compressedLen int) (raw protocol.Codec, err protocol.Error) { 51 // TODO::: 52 return 53 }