Top Fields Constructors Methods
org.xerial.snappy

public Class BitShuffle

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer

Field Summary

Modifier and TypeField and Description
private static BitShuffleNative
impl

An instance of BitShuffleNative

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

byte size of the shuffled data.
shuffle
(ByteBuffer
buffer[pos() ... limit()) containing the input data
input
,
BitShuffleType
element type of the input data
type
,
ByteBuffer
output of the shuffled data. Uses range [pos()..].
shuffled
)

Apply a bit-shuffling filter into the content in the given input buffer.

public static byte[]

Returns:

bit-shuffled byte array
shuffle
(short[] input)

Apply a bit-shuffling filter into the input short array.

public static byte[]

Returns:

bit-shuffled byte array
shuffle
(int[] input)

Apply a bit-shuffling filter into the input int array.

public static byte[]

Returns:

bit-shuffled byte array
shuffle
(long[] input)

Apply a bit-shuffling filter into the input long array.

public static byte[]

Returns:

bit-shuffled byte array
shuffle
(float[] input)

Apply a bit-shuffling filter into the input float array.

public static byte[]

Returns:

bit-shuffled byte array
shuffle
(double[] input)

Apply a bit-shuffling filter into the input double array.

public static int

Returns:

byte size of the unshuffled data.
unshuffle
(ByteBuffer
buffer[pos() ... limit()) containing the input shuffled data
shuffled
,
BitShuffleType
element type of the input data
type
,
ByteBuffer
output of the the original data. It uses buffer[pos()..]
output
)

Convert the input bit-shuffled byte array into an original array.

public static double[]

Returns:

a double array
unshuffleDoubleArray
(byte[] input)

Convert the input bit-shuffled byte array into an original double array.

public static float[]

Returns:

an float array
unshuffleFloatArray
(byte[] input)

Convert the input bit-shuffled byte array into an original float array.

public static int[]

Returns:

an int array
unshuffleIntArray
(byte[] input)

Convert the input bit-shuffled byte array into an original int array.

public static long[]

Returns:

a long array
unshuffleLongArray
(byte[] input)

Convert the input bit-shuffled byte array into an original long array.

public static short[]

Returns:

a short array
unshuffleShortArray
(byte[] input)

Convert the input bit-shuffled byte array into an original short array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

implback to summary
private static BitShuffleNative impl

An instance of BitShuffleNative

Constructor Detail

BitShuffleback to summary
public BitShuffle()

Method Detail

shuffleback to summary
public static int shuffle(ByteBuffer input, BitShuffleType type, ByteBuffer shuffled) throws IOException

Apply a bit-shuffling filter into the content in the given input buffer. After bit-shuffling, you can retrieve the shuffled data from the output buffer [pos() ...limit()) (shuffled data size = limit() - pos() = remaining()).

Parameters
input:ByteBuffer

buffer[pos() ... limit()) containing the input data

type:BitShuffleType

element type of the input data

shuffled:ByteBuffer

output of the shuffled data. Uses range [pos()..].

Returns:int

byte size of the shuffled data.

Exceptions
SnappyError:
when the input is not a direct buffer
IllegalArgumentException:
when the input length is not a multiple of the given type size
shuffleback to summary
public static byte[] shuffle(short[] input) throws IOException

Apply a bit-shuffling filter into the input short array.

Returns:byte[]

bit-shuffled byte array

shuffleback to summary
public static byte[] shuffle(int[] input) throws IOException

Apply a bit-shuffling filter into the input int array.

Returns:byte[]

bit-shuffled byte array

shuffleback to summary
public static byte[] shuffle(long[] input) throws IOException

Apply a bit-shuffling filter into the input long array.

Returns:byte[]

bit-shuffled byte array

shuffleback to summary
public static byte[] shuffle(float[] input) throws IOException

Apply a bit-shuffling filter into the input float array.

Returns:byte[]

bit-shuffled byte array

shuffleback to summary
public static byte[] shuffle(double[] input) throws IOException

Apply a bit-shuffling filter into the input double array.

Returns:byte[]

bit-shuffled byte array

unshuffleback to summary
public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer output) throws IOException

Convert the input bit-shuffled byte array into an original array. The result is dumped to the specified output buffer.

Parameters
shuffled:ByteBuffer

buffer[pos() ... limit()) containing the input shuffled data

type:BitShuffleType

element type of the input data

output:ByteBuffer

output of the the original data. It uses buffer[pos()..]

Returns:int

byte size of the unshuffled data.

Exceptions
IOException:
when failed to unshuffle the given input
SnappyError:
when the input is not a direct buffer
IllegalArgumentException:
when the length of input shuffled data is not a multiple of the given type size
unshuffleDoubleArrayback to summary
public static double[] unshuffleDoubleArray(byte[] input) throws IOException

Convert the input bit-shuffled byte array into an original double array.

Returns:double[]

a double array

unshuffleFloatArrayback to summary
public static float[] unshuffleFloatArray(byte[] input) throws IOException

Convert the input bit-shuffled byte array into an original float array.

Returns:float[]

an float array

unshuffleIntArrayback to summary
public static int[] unshuffleIntArray(byte[] input) throws IOException

Convert the input bit-shuffled byte array into an original int array.

Returns:int[]

an int array

unshuffleLongArrayback to summary
public static long[] unshuffleLongArray(byte[] input) throws IOException

Convert the input bit-shuffled byte array into an original long array.

Returns:long[]

a long array

unshuffleShortArrayback to summary
public static short[] unshuffleShortArray(byte[] input) throws IOException

Convert the input bit-shuffled byte array into an original short array.

Returns:short[]

a short array