net.jpountz.lz4
Class LZ4SafeDecompressor
- java.lang.Object
-
- net.jpountz.lz4.LZ4SafeDecompressor
-
- All Implemented Interfaces:
- LZ4UnknownSizeDecompressor
public abstract class LZ4SafeDecompressor extends java.lang.Object implements LZ4UnknownSizeDecompressor
LZ4 decompressor that requires the size of the compressed data to be known.Implementations of this class are usually a little slower than those of
LZ4FastDecompressorbut do not require the size of the original data to be known.
-
-
Constructor Summary
Constructors Constructor and Description LZ4SafeDecompressor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description intdecompress(byte[] src, byte[] dest)Convenience method, equivalent to callingdecompress(src, 0, src.length, dest, 0)byte[]decompress(byte[] src, int maxDestLen)Convenience method, equivalent to callingdecompress(src, 0, src.length, maxDestLen).intdecompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff)Convenience method, equivalent to callingdecompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff).abstract intdecompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff, int maxDestLen)Decompresssrc[srcOff:srcLen]intodest[destOff:destOff+maxDestLen]and returns the number of decompressed bytes written intodest.byte[]decompress(byte[] src, int srcOff, int srcLen, int maxDestLen)Convenience method which returnssrc[srcOff:srcOff+srcLen]decompressed.voiddecompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)Decompresssrcintodest.abstract intdecompress(java.nio.ByteBuffer src, int srcOff, int srcLen, java.nio.ByteBuffer dest, int destOff, int maxDestLen)Uncompresssrc[srcOff:srcLen]intodest[destOff:destOff+maxDestLen]and returns the number of decompressed bytes written intodest.java.lang.StringtoString()
-
-
-
Method Detail
-
decompress
public abstract int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff, int maxDestLen)Decompresssrc[srcOff:srcLen]intodest[destOff:destOff+maxDestLen]and returns the number of decompressed bytes written intodest.- Specified by:
decompressin interfaceLZ4UnknownSizeDecompressor- Parameters:
srcLen- the exact size of the compressed stream- Returns:
- the original input size
- Throws:
LZ4Exception- if maxDestLen is too small
-
decompress
public abstract int decompress(java.nio.ByteBuffer src, int srcOff, int srcLen, java.nio.ByteBuffer dest, int destOff, int maxDestLen)Uncompresssrc[srcOff:srcLen]intodest[destOff:destOff+maxDestLen]and returns the number of decompressed bytes written intodest.- Parameters:
srcLen- the exact size of the compressed stream- Returns:
- the original input size
- Throws:
LZ4Exception- if maxDestLen is too small
-
decompress
public final int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff)Convenience method, equivalent to callingdecompress(src, srcOff, srcLen, dest, destOff, dest.length - destOff).- Specified by:
decompressin interfaceLZ4UnknownSizeDecompressor
-
decompress
public final int decompress(byte[] src, byte[] dest)Convenience method, equivalent to callingdecompress(src, 0, src.length, dest, 0)
-
decompress
public final byte[] decompress(byte[] src, int srcOff, int srcLen, int maxDestLen)Convenience method which returnssrc[srcOff:srcOff+srcLen]decompressed.Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into, and then needs to resize this buffer to the actual decompressed length.
Here is how this method is implemented:
byte[] decompressed = new byte[maxDestLen]; final int decompressedLength = decompress(src, srcOff, srcLen, decompressed, 0, maxDestLen); if (decompressedLength != decompressed.length) { decompressed = Arrays.copyOf(decompressed, decompressedLength); } return decompressed;
-
decompress
public final byte[] decompress(byte[] src, int maxDestLen)Convenience method, equivalent to callingdecompress(src, 0, src.length, maxDestLen).
-
decompress
public final void decompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)Decompresssrcintodest.src'sBuffer.remaining()must be exactly the size of the compressed data. This method moves the positions of the buffers.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG