// CompressStream compresses the dest with specified compression algorithm.
CompressStream compresses the dest with specified compression algorithm.
// CompressStream compresses the dest with specified compression algorithm .
func compressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) {
        p := BufioWriter32KPool
        buf := p.Get(dest)
        switch compression {
        case Uncompressed:
                writeBufWrapper := p.NewWriteCloserWrapper(buf, buf)
                return writeBufWrapper, nil
        case Gzip:
                gzWriter := gzip.NewWriter(dest)
                writeBufWrapper := p.NewWriteCloserWrapper(buf, gzWriter)
                return writeBufWrapper, nil
        case Bzip2, Xz:
                return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension())
        default:
                return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension())
        }
}
func compressStream ( dest io . Writer , compression Compression ) ( io . WriteCloser , error ) { p := BufioWriter32KPool buf := p . Get ( dest ) switch compression { case Uncompressed : writeBufWrapper := p . NewWriteCloserWrapper ( buf , buf ) return writeBufWrapper , nil case Gzip : gzWriter := gzip . NewWriter ( dest ) writeBufWrapper := p . NewWriteCloserWrapper ( buf , gzWriter ) return writeBufWrapper , nil case Bzip2 , Xz : return nil , fmt . Errorf ( " " , ( & compression ) . Extension ( ) ) default : return nil , fmt . Errorf ( " " , ( & compression ) . Extension ( ) ) } }
CompressStream compresses the dest with specified compression algorithm.
CompressStream compresses the dest with specified compression algorithm .
// archive/bzip2 does not support writing, and there is no xz support at all // However, this is not a problem as docker only currently generates gzipped tars