+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

@ -21,6 +21,8 @@ trait Decoder {
def decodeData[T](t: T)(implicit mapper: DataMapper[T]): T =
mapper.transformDataBytes(t, newDecodeTransfomer)
def decode(input: ByteString): ByteString = newDecompressor.decompressAndFinish(input)
def newDecompressor: Decompressor
def newDecodeTransfomer(): Flow[ByteString, ByteString] = {

View file

@ -4,7 +4,6 @@
package akka.http.coding
import java.io.ByteArrayOutputStream
import akka.http.model._
import akka.http.util.StreamUtils
import akka.util.ByteString
@ -24,6 +23,8 @@ trait Encoder {
def encodeData[T](t: T)(implicit mapper: DataMapper[T]): T =
mapper.transformDataBytes(t, newEncodeTransformer)
def encode(input: ByteString): ByteString = newCompressor.compressAndFinish(input)
def newCompressor: Compressor
def newEncodeTransformer(): Flow[ByteString, ByteString] = {