Sha256: 26166f62ee2efc09998b402404256cb1bfccf25d53eb3c35a8a6064fef602b2e

Contents?: true

Size: 619 Bytes

Versions: 16

Compression:

Stored size: 619 Bytes

Contents

package jose

import (
	"bytes"
	"compress/flate"
	"io/ioutil"
)

func init() {
	RegisterJwc(new(Deflate))
}

// Deflate compression algorithm implementation
type Deflate struct {}

func (alg *Deflate) Name() string {
	return DEF
}

func (alg *Deflate) Compress(plainText []byte) []byte {
	var buf bytes.Buffer
	deflate,_ := flate.NewWriter(&buf, 8) //level=DEFLATED
	
	deflate.Write(plainText)
	deflate.Close()
	
	return buf.Bytes()
}

func (alg *Deflate) Decompress(compressedText []byte) []byte {	
	
	enflated,_ := ioutil.ReadAll(
					flate.NewReader(
						bytes.NewReader(compressedText)))
	
	return enflated
}


Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/dvsekhvalnov/jose2go/deflate.go