Examples of LZ4FastDecompressor


Examples of net.jpountz.lz4.LZ4FastDecompressor

    byte[] compressed = new byte[maxCompressedLength];
    int compressedLength = compressor.compress(data, 0, decompressedLength, compressed, 0, maxCompressedLength);

    // decompress data
    // - method 1: when the decompressed length is known
    LZ4FastDecompressor decompressor = factory.fastDecompressor();
    byte[] restored = new byte[decompressedLength];
    int compressedLength2 = decompressor.decompress(compressed, 0, restored, 0, decompressedLength);
    // compressedLength == compressedLength2

    // - method 2: when the compressed length is known (a little slower)
    // the destination buffer needs to be over-sized
    LZ4SafeDecompressor decompressor2 = factory.safeDecompressor();
View Full Code Here

Examples of net.jpountz.lz4.LZ4FastDecompressor

      int compressedLength = bytes.length - 4;
      ByteBuffer compbb = ByteBuffer.wrap(bytes);
      int decompressedLength = compbb.getInt();

     
      LZ4FastDecompressor decompressor = factory.fastDecompressor();
      byte[] decompressedBytes = new byte[decompressedLength];
      int compressedLength2 = decompressor.decompress(bytes, 4, decompressedBytes, 0, decompressedLength);
     
      assert(compressedLength == compressedLength2);
     
      return codecUncompressed.createObjectFromBytes(decompressedBytes);
   }
View Full Code Here

Examples of net.jpountz.lz4.LZ4FastDecompressor

      int compressedLength      = buffer.getInt() - 4;
      int decompressedLength    = buffer.getInt();
      int compressedBytesOffset = buffer.arrayOffset() + buffer.position();
      byte[] compressedBytes    = buffer.array();
     
      LZ4FastDecompressor decompressor = factory.fastDecompressor();
      byte[] decompressedBytes = new byte[decompressedLength];
      int compressedLength2 = decompressor.decompress(compressedBytes, compressedBytesOffset, decompressedBytes, 0, decompressedLength);
     
      assert(compressedLength == compressedLength2);
     
      return codecUncompressed.createObjectFromBytes(decompressedBytes);
   }
View Full Code Here

Examples of net.jpountz.lz4.LZ4FastDecompressor

            {
                in = new DataInputStream(new SnappyInputStream(socket.getInputStream()));
            }
            else
            {
                LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
                Checksum checksum = XXHashFactory.fastestInstance().newStreamingHash32(OutboundTcpConnection.LZ4_HASH_SEED).asChecksum();
                in = new DataInputStream(new LZ4BlockInputStream(socket.getInputStream(),
                                                                 decompressor,
                                                                 checksum));
            }
View Full Code Here

Examples of net.jpountz.lz4.LZ4FastDecompressor

            logger.debug("Upgrading incoming connection to be compressed");
            if (version < MessagingService.VERSION_21)
                in = new DataInputStream(new SnappyInputStream(socket.getInputStream()));
            else
            {
                LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
                Checksum checksum = XXHashFactory.fastestInstance().newStreamingHash32(OutboundTcpConnection.LZ4_HASH_SEED).asChecksum();
                in = new DataInputStream(new LZ4BlockInputStream(socket.getInputStream(),
                                                                 decompressor,
                                                                 checksum));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.