+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
|
|
@ -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] = {
|
||||
|
|
|
|||
|
|
@ -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] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue