Skip to content

Commit 65e1ec3

Browse files
authored
Revert "feature: Add bit-shuffling interfaces for unshuffle with provided out…" (#640)
This reverts commit 4277fbc.
1 parent 466d05f commit 65e1ec3

File tree

2 files changed

+0
-132
lines changed

2 files changed

+0
-132
lines changed

src/main/java/org/xerial/snappy/BitShuffle.java

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -208,35 +208,6 @@ 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-
240211
/**
241212
* Convert the input bit-shuffled byte array into an original short array.
242213
*
@@ -251,21 +222,6 @@ public static short[] unshuffleShortArray(byte[] input) throws IOException {
251222
return output;
252223
}
253224

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-
269225
/**
270226
* Convert the input bit-shuffled byte array into an original int array.
271227
*
@@ -280,21 +236,6 @@ public static int[] unshuffleIntArray(byte[] input) throws IOException {
280236
return output;
281237
}
282238

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-
298239
/**
299240
* Convert the input bit-shuffled byte array into an original long array.
300241
*
@@ -309,21 +250,6 @@ public static long[] unshuffleLongArray(byte[] input) throws IOException {
309250
return output;
310251
}
311252

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-
327253
/**
328254
* Convert the input bit-shuffled byte array into an original float array.
329255
*
@@ -338,21 +264,6 @@ public static float[] unshuffleFloatArray(byte[] input) throws IOException {
338264
return output;
339265
}
340266

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-
356267
/**
357268
* Convert the input bit-shuffled byte array into an original double array.
358269
*
@@ -366,19 +277,4 @@ public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
366277
assert(numProcessed == input.length);
367278
return output;
368279
}
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-
}
384280
}

src/test/java/org/xerial/snappy/BitShuffleTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -276,22 +276,6 @@ public void shuffleLongArray()
276276
byte[] shuffledData = BitShuffle.shuffle(data);
277277
long[] result = BitShuffle.unshuffleLongArray(shuffledData);
278278
assertArrayEquals(data, result);
279-
long[] output = new long[data.length];
280-
BitShuffle.unshuffleLongArray(shuffledData, output);
281-
assertArrayEquals(data, output);
282-
}
283-
284-
@Test
285-
public void shuffleByteArray()
286-
throws Exception
287-
{
288-
byte[] data = new byte[] {43, -32, 1, 3, 34, 43, 34, Byte.MAX_VALUE, -1};
289-
byte[] shuffledData = BitShuffle.shuffle(data);
290-
byte[] result = BitShuffle.unshuffleByteArray(shuffledData);
291-
assertArrayEquals(data, result);
292-
byte[] output = new byte[data.length];
293-
BitShuffle.unshuffleByteArray(shuffledData, output);
294-
assertArrayEquals(data, output);
295279
}
296280

297281
@Test
@@ -302,9 +286,6 @@ public void shuffleShortArray()
302286
byte[] shuffledData = BitShuffle.shuffle(data);
303287
short[] result = BitShuffle.unshuffleShortArray(shuffledData);
304288
assertArrayEquals(data, result);
305-
short[] output = new short[data.length];
306-
BitShuffle.unshuffleShortArray(shuffledData, output);
307-
assertArrayEquals(data, output);
308289
}
309290

310291
@Test
@@ -315,9 +296,6 @@ public void shuffleIntArray()
315296
byte[] shuffledData = BitShuffle.shuffle(data);
316297
int[] result = BitShuffle.unshuffleIntArray(shuffledData);
317298
assertArrayEquals(data, result);
318-
int[] output = new int[data.length];
319-
BitShuffle.unshuffleIntArray(shuffledData, output);
320-
assertArrayEquals(data, output);
321299
}
322300

323301
@Test
@@ -328,9 +306,6 @@ public void shuffleFloatArray()
328306
byte[] shuffledData = BitShuffle.shuffle(data);
329307
float[] result = BitShuffle.unshuffleFloatArray(shuffledData);
330308
assertArrayEquals(data, result, 0.0000001f);
331-
float[] output = new float[data.length];
332-
BitShuffle.unshuffleFloatArray(shuffledData, output);
333-
assertArrayEquals(data, output);
334309
}
335310

336311
@Test
@@ -341,8 +316,5 @@ public void shuffleDoubleArray()
341316
byte[] shuffledData = BitShuffle.shuffle(data);
342317
double[] result = BitShuffle.unshuffleDoubleArray(shuffledData);
343318
assertArrayEquals(data, result, 0.0000001f);
344-
double[] output = new double[data.length];
345-
BitShuffle.unshuffleDoubleArray(shuffledData, output);
346-
assertArrayEquals(data, output);
347319
}
348320
}

0 commit comments

Comments
 (0)