public class Snappy
extends java.lang.Object
| Constructor and Description |
|---|
Snappy() |
| Modifier and Type | Method and Description |
|---|---|
static void |
arrayCopy(java.lang.Object src,
int offset,
int byteLength,
java.lang.Object dest,
int dest_offset)
Copy bytes from source to destination
|
static byte[] |
compress(byte[] input)
High-level API for compressing the input byte array.
|
static int |
compress(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Compress the input buffer content in [inputOffset,
...inputOffset+inputLength) then output to the specified output buffer.
|
static int |
compress(java.nio.ByteBuffer uncompressed,
java.nio.ByteBuffer compressed)
Compress the content in the given input buffer.
|
static byte[] |
compress(char[] input) |
static byte[] |
compress(double[] input) |
static byte[] |
compress(float[] input) |
static byte[] |
compress(int[] input) |
static byte[] |
compress(long[] input) |
static byte[] |
compress(short[] input) |
static byte[] |
compress(java.lang.String s) |
static byte[] |
compress(java.lang.String s,
java.lang.String encoding) |
static java.lang.String |
getNativeLibraryVersion()
Get the native library version of the snappy
|
static boolean |
isValidCompressedBuffer(byte[] input)
Returns true iff the contents of compressed buffer [offset,
offset+length) can be uncompressed successfully.
|
static boolean |
isValidCompressedBuffer(byte[] input,
int offset,
int length)
Returns true iff the contents of compressed buffer [offset,
offset+length) can be uncompressed successfully.
|
static boolean |
isValidCompressedBuffer(java.nio.ByteBuffer compressed)
Returns true iff the contents of compressed buffer [pos() ...
|
static int |
maxCompressedLength(int byteSize)
Get the maximum byte size needed for compressing data of the given byte
size.
|
static byte[] |
rawCompress(java.lang.Object data,
int byteSize)
Compress the input data and produce a byte array of the uncompressed data
|
static int |
rawCompress(java.lang.Object input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Compress the input buffer [offset,...
|
static int |
rawUncompress(byte[] input,
int inputOffset,
int inputLength,
java.lang.Object output,
int outputOffset)
Uncompress the content in the input buffer.
|
static byte[] |
uncompress(byte[] input)
High-level API for uncompressing the input byte array.
|
static int |
uncompress(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Uncompress the content in the input buffer.
|
static int |
uncompress(java.nio.ByteBuffer compressed,
java.nio.ByteBuffer uncompressed)
Uncompress the content in the input buffer.
|
static char[] |
uncompressCharArray(byte[] input) |
static char[] |
uncompressCharArray(byte[] input,
int offset,
int length) |
static double[] |
uncompressDoubleArray(byte[] input) |
static int |
uncompressedLength(byte[] input)
Get the uncompressed byte size of the given compressed input.
|
static int |
uncompressedLength(byte[] input,
int offset,
int length)
Get the uncompressed byte size of the given compressed input.
|
static int |
uncompressedLength(java.nio.ByteBuffer compressed)
Get the uncompressed byte size of the given compressed input.
|
static float[] |
uncompressFloatArray(byte[] input) |
static float[] |
uncompressFloatArray(byte[] input,
int offset,
int length) |
static int[] |
uncompressIntArray(byte[] input) |
static int[] |
uncompressIntArray(byte[] input,
int offset,
int length) |
static long[] |
uncompressLongArray(byte[] input) |
static long[] |
uncompressLongArray(byte[] input,
int offset,
int length) |
static short[] |
uncompressShortArray(byte[] input) |
static short[] |
uncompressShortArray(byte[] input,
int offset,
int length) |
static java.lang.String |
uncompressString(byte[] input) |
static java.lang.String |
uncompressString(byte[] input,
int offset,
int length) |
static java.lang.String |
uncompressString(byte[] input,
int offset,
int length,
java.lang.String encoding) |
static java.lang.String |
uncompressString(byte[] input,
java.lang.String encoding) |
public static void arrayCopy(java.lang.Object src,
int offset,
int byteLength,
java.lang.Object dest,
int dest_offset)
throws java.io.IOException
src - pointer to the source arrayoffset - byte offset in the source arraybyteLength - the number of bytes to copydest - pointer to the destination arraydest_offset - byte offset in the destination arrayjava.io.IOExceptionpublic static byte[] compress(byte[] input)
throws java.io.IOException
compress(byte[], int, int, byte[], int) or
compress(ByteBuffer, ByteBuffer).input - the input datajava.io.IOExceptionpublic static int compress(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws java.io.IOException
input - inputOffset - inputLength - output - outputOffset - java.io.IOException - when failed to access the input/output bufferpublic static int compress(java.nio.ByteBuffer uncompressed,
java.nio.ByteBuffer compressed)
throws java.io.IOException
uncompressed - buffer[pos() ... limit()) containing the input datacompressed - output of the compressed data. Uses range [pos()..].SnappyError - when the input is not a direct bufferjava.io.IOExceptionpublic static byte[] compress(char[] input)
public static byte[] compress(double[] input)
public static byte[] compress(float[] input)
public static byte[] compress(int[] input)
public static byte[] compress(long[] input)
public static byte[] compress(short[] input)
public static byte[] compress(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] compress(java.lang.String s,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException,
java.io.IOException
java.io.UnsupportedEncodingExceptionjava.io.IOExceptionpublic static java.lang.String getNativeLibraryVersion()
public static boolean isValidCompressedBuffer(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isValidCompressedBuffer(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isValidCompressedBuffer(java.nio.ByteBuffer compressed)
throws java.io.IOException
java.io.IOExceptionpublic static int maxCompressedLength(int byteSize)
byteSize - byte size of the data to compresspublic static byte[] rawCompress(java.lang.Object data,
int byteSize)
data - input array. The input MUST be an array typebyteSize - the input byte sizepublic static int rawCompress(java.lang.Object input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws java.io.IOException
input - input array. This MUST be primitive array typeinputOffset - byte offset at the output arrayinputLength - byte length of the input dataoutput - output array. This MUST be primitive array typeoutputOffset - byte offset at the output arrayjava.io.IOExceptionpublic static int rawUncompress(byte[] input,
int inputOffset,
int inputLength,
java.lang.Object output,
int outputOffset)
throws java.io.IOException
isValidCompressedBuffer(byte[], int, int) first.input - input byte arrayinputOffset - byte offsetinputLength - byte length of the input dataoutput - output buffer, MUST be a primitive type arrayoutputOffset - byte offsetjava.io.IOExceptionpublic static byte[] uncompress(byte[] input)
throws java.io.IOException
input - java.io.IOExceptionpublic static int uncompress(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws java.io.IOException
isValidCompressedBuffer(byte[], int, int) first.input - inputOffset - inputLength - output - outputOffset - java.io.IOExceptionpublic static int uncompress(java.nio.ByteBuffer compressed,
java.nio.ByteBuffer uncompressed)
throws java.io.IOException
isValidCompressedBuffer(ByteBuffer) first.compressed - buffer[pos() ... limit()) containing the input datauncompressed - output of the the uncompressed data. It uses buffer[pot()..]java.io.IOException - when failed to uncompress the given inputSnappyError - when the input is not a direct bufferpublic static char[] uncompressCharArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static char[] uncompressCharArray(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static double[] uncompressDoubleArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static int uncompressedLength(byte[] input)
throws java.io.IOException
input - java.io.IOException - when failed to uncompress the given input. The error code is
SnappyErrorCode.PARSING_ERRORpublic static int uncompressedLength(byte[] input,
int offset,
int length)
throws java.io.IOException
input - offset - length - java.io.IOException - when failed to uncompress the given input. The error code is
SnappyErrorCode.PARSING_ERRORpublic static int uncompressedLength(java.nio.ByteBuffer compressed)
throws java.io.IOException
compressed - input data [pos() ... limit())java.io.IOException - when failed to uncompress the given input. The error code is
SnappyErrorCode.PARSING_ERRORSnappyError - when the input is not a direct bufferpublic static float[] uncompressFloatArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static float[] uncompressFloatArray(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static int[] uncompressIntArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static int[] uncompressIntArray(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static long[] uncompressLongArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static long[] uncompressLongArray(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static short[] uncompressShortArray(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static short[] uncompressShortArray(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String uncompressString(byte[] input)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String uncompressString(byte[] input,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String uncompressString(byte[] input,
int offset,
int length,
java.lang.String encoding)
throws java.io.IOException,
java.io.UnsupportedEncodingException
java.io.IOExceptionjava.io.UnsupportedEncodingExceptionpublic static java.lang.String uncompressString(byte[] input,
java.lang.String encoding)
throws java.io.IOException,
java.io.UnsupportedEncodingException
java.io.IOExceptionjava.io.UnsupportedEncodingExceptionCopyright © 2023. All Rights Reserved.