/** * Uncompress the input data as char array * * @param input * @return the uncompressed data * @throws IOException */ public static char[] uncompressCharArray(byte[] input) throws IOException { return uncompressCharArray(input, 0, input.length); }
@Override final public String[] toValue(byte[] compressedByteArray) throws IOException { if (compressedByteArray == null) return null; char[] chars = Snappy.uncompressCharArray(compressedByteArray); if (chars.length == 0) return emptyStringArray; List<String> array = new ArrayList<>(); int last = 0; int pos = 0; for (char c : chars) { if (c == 0) { array.add(new String(chars, last, pos - last)); last = pos + 1; } pos++; } return array.toArray(new String[array.size()]); }