Search in sources :

Example 1 with SnappyInputStream

use of org.iq80.snappy.SnappyInputStream in project NabAlive by jcheype.

the class DataUtil method decompress.

public static byte[] decompress(byte[] in) throws IOException {
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(in);
    SnappyInputStream inputStream = new SnappyInputStream(byteArrayInputStream);
    return ByteStreams.toByteArray(inputStream);
}
Also used : SnappyInputStream(org.iq80.snappy.SnappyInputStream)

Example 2 with SnappyInputStream

use of org.iq80.snappy.SnappyInputStream in project NabAlive by jcheype.

the class TokenUtil method decode.

public static <T> T decode(byte[] cryptedBytes, Class<T> clazz) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, DecoderException, IOException {
    byte[] bytes = cipherDecrypt.get().doFinal(cryptedBytes);
    SnappyInputStream snappyInputStream = new SnappyInputStream(new ByteArrayInputStream(bytes));
    //MessagePack messagePack = new MessagePack();
    return messagePack.read(ByteStreams.toByteArray(snappyInputStream), clazz);
}
Also used : SnappyInputStream(org.iq80.snappy.SnappyInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream)

Example 3 with SnappyInputStream

use of org.iq80.snappy.SnappyInputStream in project NabAlive by jcheype.

the class DataUtil method decompress.

public static ChannelBuffer decompress(ChannelBuffer in) throws IOException {
    ChannelBufferInputStream channelBufferInputStream = new ChannelBufferInputStream(in);
    SnappyInputStream inputStream = new SnappyInputStream(channelBufferInputStream);
    ChannelBuffer channelBuffer = ChannelBuffers.copiedBuffer(ByteStreams.toByteArray(inputStream));
    return channelBuffer;
}
Also used : SnappyInputStream(org.iq80.snappy.SnappyInputStream) ChannelBufferInputStream(org.jboss.netty.buffer.ChannelBufferInputStream) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Aggregations

SnappyInputStream (org.iq80.snappy.SnappyInputStream)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)1 ChannelBufferInputStream (org.jboss.netty.buffer.ChannelBufferInputStream)1