public static CompressedRandomAccessReader open(String path, CompressionMetadata metadata, CompressedPoolingSegmentedFile owner) { try { return new CompressedRandomAccessReader(path, metadata, owner); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
throw new CorruptBlockException(getPath(), chunk); throw new CorruptBlockException(getPath(), chunk, e); if (checksum(chunk) != (int) checksum.getValue()) throw new CorruptBlockException(getPath(), chunk); if (bufferOffset + validBufferBytes > length()) validBufferBytes = (int)(length() - bufferOffset);
@Override protected void reBuffer() { try { decompressChunk(metadata.chunkFor(current)); } catch (CorruptBlockException e) { throw new CorruptSSTableException(e, getPath()); } catch (IOException e) { throw new FSReadError(e, getPath()); } }
public RandomAccessReader createReader() { return CompressedRandomAccessReader.open(path, metadata); }
private int checksum(CompressionMetadata.Chunk chunk) throws IOException { assert channel.position() == chunk.offset + chunk.length; checksumBytes.clear(); if (channel.read(checksumBytes) != checksumBytes.capacity()) throw new CorruptBlockException(getPath(), chunk); return checksumBytes.getInt(0); }
protected void reBuffer() { limiter.acquire(buffer.length); super.reBuffer(); }
protected RandomAccessReader createPooledReader() { return CompressedRandomAccessReader.open(path, metadata, this); }
@Override public String toString() { return String.format("%s - chunk length %d, data length %d.", getPath(), metadata.chunkLength(), metadata.dataLength); } }
public RandomAccessReader createReader() { return CompressedRandomAccessReader.open(path, metadata, null); }