private static double parseDouble(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Double.parseDouble(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid double value"); } } }
private RcFileCorruptionException corrupt(String messageFormat, Object... args) { closeQuietly(); return new RcFileCorruptionException(messageFormat, args); }
private static float parseFloat(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Float.parseFloat(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid float value"); } } }
private int readNextValueLength() throws IOException { if (runLength > 0) { runLength--; return lastValueLength; } int valueLength = toIntExact(readVInt(lengthsInput)); // negative length is used to encode a run or the last value if (valueLength < 0) { if (lastValueLength == -1) { throw new RcFileCorruptionException("First column value length is negative"); } runLength = (~valueLength) - 1; return lastValueLength; } runLength = 0; lastValueLength = valueLength; return valueLength; }
throw new RcFileCorruptionException(e, "Validation failed");
@Override public void decompress(Slice compressed, Slice uncompressed) throws RcFileCorruptionException { checkState(!destroyed, "Codec has been destroyed"); decompressor.reset(); try (CompressionInputStream decompressorStream = codec.createInputStream(compressed.getInput(), decompressor)) { uncompressed.setBytes(0, decompressorStream, uncompressed.length()); } catch (IndexOutOfBoundsException | IOException e) { throw new RcFileCorruptionException(e, "Compressed stream is truncated"); } }
@Override public void decompress(Slice compressed, Slice uncompressed) throws RcFileCorruptionException { try (CompressionInputStream decompressorStream = codec.createInputStream(compressed.getInput())) { uncompressed.setBytes(0, decompressorStream, uncompressed.length()); } catch (IndexOutOfBoundsException | IOException e) { throw new RcFileCorruptionException(e, "Compressed stream is truncated"); } }
private static double parseDouble(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Double.parseDouble(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid double value"); } } }
private static float parseFloat(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Float.parseFloat(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid float value"); } } }
private RcFileCorruptionException corrupt(String messageFormat, Object... args) { closeQuietly(); return new RcFileCorruptionException(messageFormat, args); }
private int readNextValueLength() throws IOException { if (runLength > 0) { runLength--; return lastValueLength; } int valueLength = toIntExact(readVInt(lengthsInput)); // negative length is used to encode a run or the last value if (valueLength < 0) { if (lastValueLength == -1) { throw new RcFileCorruptionException("First column value length is negative"); } runLength = (~valueLength) - 1; return lastValueLength; } runLength = 0; lastValueLength = valueLength; return valueLength; }
throw new RcFileCorruptionException(e, "Validation failed");
@Override public void decompress(Slice compressed, Slice uncompressed) throws RcFileCorruptionException { checkState(!destroyed, "Codec has been destroyed"); decompressor.reset(); try (CompressionInputStream decompressorStream = codec.createInputStream(compressed.getInput(), decompressor)) { uncompressed.setBytes(0, decompressorStream, uncompressed.length()); } catch (IndexOutOfBoundsException | IOException e) { throw new RcFileCorruptionException(e, "Compressed stream is truncated"); } }
@Override public void decompress(Slice compressed, Slice uncompressed) throws RcFileCorruptionException { try (CompressionInputStream decompressorStream = codec.createInputStream(compressed.getInput())) { uncompressed.setBytes(0, decompressorStream, uncompressed.length()); } catch (IndexOutOfBoundsException | IOException e) { throw new RcFileCorruptionException(e, "Compressed stream is truncated"); } }