@@ -208,6 +208,35 @@ public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer
208208 return numProcessed ;
209209 }
210210
211+ /**
212+ * Convert the input bit-shuffled byte array into an original byte array.
213+ *
214+ * @param input
215+ * @return a byte array
216+ * @throws IOException
217+ */
218+ public static byte [] unshuffleByteArray (byte [] input ) throws IOException {
219+ byte [] output = new byte [input .length ];
220+ int numProcessed = impl .unshuffle (input , 0 , 1 , input .length , output , 0 );
221+ assert (numProcessed == input .length );
222+ return output ;
223+ }
224+
225+ /**
226+ * Convert the input bit-shuffled byte array into an original byte array.
227+ *
228+ * @param input
229+ * @param output
230+ * @return byte size of the unshuffled data.
231+ * @throws IOException
232+ */
233+ public static int unshuffleByteArray (byte [] input , byte [] output ) throws IOException {
234+ assert (input .length == output .length );
235+ int numProcessed = impl .unshuffle (input , 0 , 1 , input .length , output , 0 );
236+ assert (numProcessed == input .length );
237+ return numProcessed ;
238+ }
239+
211240 /**
212241 * Convert the input bit-shuffled byte array into an original short array.
213242 *
@@ -222,6 +251,21 @@ public static short[] unshuffleShortArray(byte[] input) throws IOException {
222251 return output ;
223252 }
224253
254+ /**
255+ * Convert the input bit-shuffled byte array into an original short array.
256+ *
257+ * @param input
258+ * @param output
259+ * @return byte size of the unshuffled data.
260+ * @throws IOException
261+ */
262+ public static int unshuffleShortArray (byte [] input , short [] output ) throws IOException {
263+ assert (input .length == output .length * 2 );
264+ int numProcessed = impl .unshuffle (input , 0 , 2 , input .length , output , 0 );
265+ assert (numProcessed == input .length );
266+ return numProcessed ;
267+ }
268+
225269 /**
226270 * Convert the input bit-shuffled byte array into an original int array.
227271 *
@@ -236,6 +280,21 @@ public static int[] unshuffleIntArray(byte[] input) throws IOException {
236280 return output ;
237281 }
238282
283+ /**
284+ * Convert the input bit-shuffled byte array into an original int array.
285+ *
286+ * @param input
287+ * @param output
288+ * @return byte size of the unshuffled data.
289+ * @throws IOException
290+ */
291+ public static int unshuffleIntArray (byte [] input , int [] output ) throws IOException {
292+ assert (input .length == output .length * 4 );
293+ int numProcessed = impl .unshuffle (input , 0 , 4 , input .length , output , 0 );
294+ assert (numProcessed == input .length );
295+ return numProcessed ;
296+ }
297+
239298 /**
240299 * Convert the input bit-shuffled byte array into an original long array.
241300 *
@@ -250,6 +309,21 @@ public static long[] unshuffleLongArray(byte[] input) throws IOException {
250309 return output ;
251310 }
252311
312+ /**
313+ * Convert the input bit-shuffled byte array into an original long array.
314+ *
315+ * @param input
316+ * @param output
317+ * @return byte size of the unshuffled data.
318+ * @throws IOException
319+ */
320+ public static int unshuffleLongArray (byte [] input , long [] output ) throws IOException {
321+ assert (input .length == output .length * 8 );
322+ int numProcessed = impl .unshuffle (input , 0 , 8 , input .length , output , 0 );
323+ assert (numProcessed == input .length );
324+ return numProcessed ;
325+ }
326+
253327 /**
254328 * Convert the input bit-shuffled byte array into an original float array.
255329 *
@@ -264,6 +338,21 @@ public static float[] unshuffleFloatArray(byte[] input) throws IOException {
264338 return output ;
265339 }
266340
341+ /**
342+ * Convert the input bit-shuffled byte array into an original float array.
343+ *
344+ * @param input
345+ * @param output
346+ * @return byte size of the unshuffled data.
347+ * @throws IOException
348+ */
349+ public static int unshuffleFloatArray (byte [] input , float [] output ) throws IOException {
350+ assert (input .length == output .length * 4 );
351+ int numProcessed = impl .unshuffle (input , 0 , 4 , input .length , output , 0 );
352+ assert (numProcessed == input .length );
353+ return numProcessed ;
354+ }
355+
267356 /**
268357 * Convert the input bit-shuffled byte array into an original double array.
269358 *
@@ -277,4 +366,19 @@ public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
277366 assert (numProcessed == input .length );
278367 return output ;
279368 }
369+
370+ /**
371+ * Convert the input bit-shuffled byte array into an original double array.
372+ *
373+ * @param input
374+ * @param output
375+ * @return byte size of the unshuffled data.
376+ * @throws IOException
377+ */
378+ public static int unshuffleDoubleArray (byte [] input , double [] output ) throws IOException {
379+ assert (input .length == output .length * 8 );
380+ int numProcessed = impl .unshuffle (input , 0 , 8 , input .length , output , 0 );
381+ assert (numProcessed == input .length );
382+ return numProcessed ;
383+ }
280384}
0 commit comments