Package org.iq80.snappy

Examples of org.iq80.snappy.SnappyOutputStream


    protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
        return new SnappyOutputStream(underlying);
    }

    protected InputStream wrapInputStream(InputStream underlying) throws IOException {
        return new SnappyInputStream(underlying);
    }
View Full Code Here


        snappyOutputStream.close();
    }

    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;
    }
View Full Code Here

        return channelBuffer;
    }

    public static byte[] decompress(byte[] in) throws IOException {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(in);
        SnappyInputStream inputStream = new SnappyInputStream(byteArrayInputStream);
        return ByteStreams.toByteArray(inputStream);
    }
View Full Code Here

    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);
    }
View Full Code Here

    public String getType() {
        return "snappy";
    }

    protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
        return new SnappyOutputStream(underlying);
    }
View Full Code Here

        return byteArrayOutputStream.toByteArray();
    }

    public static void compress(byte[] in, OutputStream out) throws IOException {
        SnappyOutputStream snappyOutputStream = new SnappyOutputStream(out);
        snappyOutputStream.write(in);
        snappyOutputStream.close();
    }
View Full Code Here

        byte[] origBytes = messagePack.write(object);
        System.out.println("orig length: " + origBytes.length);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        SnappyOutputStream snappyOutputStream = new SnappyOutputStream(out);
        snappyOutputStream.write(origBytes);
        snappyOutputStream.close();

        byte[] comressedBytes = out.toByteArray();
        System.out.println("comressedBytes length: " + comressedBytes.length);

        byte[] bytes = cipherEncrypt.get().doFinal(comressedBytes);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    protected OutputStream wrapCompressInternal(OutputStream out) throws IOException {
        return new SnappyOutputStream(out);
    }
View Full Code Here

//    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      SnappyOutputStream snappyOutputStream = new SnappyOutputStream(baos);
      snappyOutputStream.write(uncompressedBytes);
      snappyOutputStream.close();
      baos.close();
    } catch (IOException e) {
      // This should not happen
      logger.error("Could not compress sensei request ", e);
    }
View Full Code Here

//    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      SnappyOutputStream snappyOutputStream = new SnappyOutputStream(baos);
      snappyOutputStream.write(uncompressedBytes);
      snappyOutputStream.close();
      baos.close();
    } catch (IOException e) {
      // This should not happen
      logger.error("Could not compress sensei request ", e);
    }
View Full Code Here

TOP

Related Classes of org.iq80.snappy.SnappyOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.