+htp add shortcuts for quick encoding / decoding
This commit is contained in:
parent
0b1dd68eaf
commit
2a37831937
4 changed files with 8 additions and 5 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue