+htp add shortcuts for quick encoding / decoding

This commit is contained in:
Johannes Rudolph 2014-11-27 18:11:40 +01:00
parent 0b1dd68eaf
commit 2a37831937
4 changed files with 8 additions and 5 deletions

View file

@ -65,8 +65,8 @@ class DeflateSpec extends WordSpec with CodecSpecSupport {
}
}
def ourDeflate(bytes: ByteString): ByteString = Deflate.newCompressor.compressAndFinish(bytes)
def ourInflate(bytes: ByteString): ByteString = Deflate.newDecompressor.decompress(bytes)
def ourDeflate(bytes: ByteString): ByteString = Deflate.encode(bytes)
def ourInflate(bytes: ByteString): ByteString = Deflate.decode(bytes)
def streamDeflate(bytes: ByteString) = {
val output = new ByteArrayOutputStream()

View file

@ -103,8 +103,8 @@ class GzipSpec extends WordSpec with CodecSpecSupport {
}
def gzip(s: String) = ourGzip(ByteString(s, "UTF8"))
def ourGzip(bytes: ByteString): ByteString = Gzip.newCompressor.compressAndFinish(bytes)
def ourGunzip(bytes: ByteString): ByteString = Gzip.newDecompressor.decompressAndFinish(bytes)
def ourGzip(bytes: ByteString): ByteString = Gzip.encode(bytes)
def ourGunzip(bytes: ByteString): ByteString = Gzip.decode(bytes)
lazy val corruptGzipContent = {
val content = gzip("Hello").toArray