@@ -208,6 +208,35 @@ public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer
208
208
return numProcessed ;
209
209
}
210
210
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
+
211
240
/**
212
241
* Convert the input bit-shuffled byte array into an original short array.
213
242
*
@@ -222,6 +251,21 @@ public static short[] unshuffleShortArray(byte[] input) throws IOException {
222
251
return output ;
223
252
}
224
253
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
+
225
269
/**
226
270
* Convert the input bit-shuffled byte array into an original int array.
227
271
*
@@ -236,6 +280,21 @@ public static int[] unshuffleIntArray(byte[] input) throws IOException {
236
280
return output ;
237
281
}
238
282
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
+
239
298
/**
240
299
* Convert the input bit-shuffled byte array into an original long array.
241
300
*
@@ -250,6 +309,21 @@ public static long[] unshuffleLongArray(byte[] input) throws IOException {
250
309
return output ;
251
310
}
252
311
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
+
253
327
/**
254
328
* Convert the input bit-shuffled byte array into an original float array.
255
329
*
@@ -264,6 +338,21 @@ public static float[] unshuffleFloatArray(byte[] input) throws IOException {
264
338
return output ;
265
339
}
266
340
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
+
267
356
/**
268
357
* Convert the input bit-shuffled byte array into an original double array.
269
358
*
@@ -277,4 +366,19 @@ public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
277
366
assert (numProcessed == input .length );
278
367
return output ;
279
368
}
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
+ }
280
384
}
0 commit comments