DfsBlock readOneBlock(long pos, DfsReader ctx, @Nullable ReadableChannel fileChannel) throws IOException { if (invalid) throw new PackInvalidException(getFileName()); : ctx.db.openFile(desc, ext); try { int size = blockSize(rc); pos = (pos / size) * size; throw new EOFException(MessageFormat.format( DfsText.get().shortReadOfBlock, Long.valueOf(pos), getFileName(), Long.valueOf(0), Long.valueOf(0))); int cnt = read(rc, ByteBuffer.wrap(buf, 0, size)); ctx.stats.readBlockBytes += cnt; if (cnt != size) { throw new EOFException(MessageFormat.format( DfsText.get().shortReadOfBlock, Long.valueOf(pos), getFileName(), Integer.valueOf(size), Integer.valueOf(cnt))); rc.close(); ctx.stats.readBlockMicros += elapsedMicros(start);
void pin(BlockBasedFile file, long position) throws IOException { if (block == null || !block.contains(file.key, position)) { // If memory is low, we may need what is in our window field to // be cleaned up by the GC during the get for the next window. // So we always clear it, even though we are just going to set // it again. block = null; block = file.getOrLoadBlock(position, this); } }
@Nullable ReadableChannel fileChannel) throws IOException { final long requestedPosition = position; position = file.alignToBlock(position); boolean credit = true; try { v = file.readOneBlock(requestedPosition, ctx, fileChannel); credit = false; } finally {
@Nullable ReadableChannel fileChannel) throws IOException { final long requestedPosition = position; position = file.alignToBlock(position); boolean credit = true; try { v = file.readOneBlock(requestedPosition, ctx, fileChannel); credit = false; } finally {
DfsBlock readOneBlock(long pos, DfsReader ctx, @Nullable ReadableChannel fileChannel) throws IOException { if (invalid) throw new PackInvalidException(getFileName()); : ctx.db.openFile(desc, ext); try { int size = blockSize(rc); pos = (pos / size) * size; throw new EOFException(MessageFormat.format( DfsText.get().shortReadOfBlock, Long.valueOf(pos), getFileName(), Long.valueOf(0), Long.valueOf(0))); int cnt = read(rc, ByteBuffer.wrap(buf, 0, size)); ctx.stats.readBlockBytes += cnt; if (cnt != size) { throw new EOFException(MessageFormat.format( DfsText.get().shortReadOfBlock, Long.valueOf(pos), getFileName(), Integer.valueOf(size), Integer.valueOf(cnt))); rc.close(); ctx.stats.readBlockMicros += elapsedMicros(start);
void pin(BlockBasedFile file, long position) throws IOException { if (block == null || !block.contains(file.key, position)) { // If memory is low, we may need what is in our window field to // be cleaned up by the GC during the get for the next window. // So we always clear it, even though we are just going to set // it again. block = null; block = file.getOrLoadBlock(position, this); } }