private boolean checkCache(long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) { return _cache.fetch(_cacheName, blockId, blockOffset, b, off, lengthToReadInBlock); }
public void deleteFile(String name) throws IOException { _cache.delete(getFileCacheName(name)); _directory.deleteFile(name); }
private void readIntoCacheAndResult(long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) throws IOException { long position = getRealPosition(blockId, 0); int length = (int) Math.min(_blockSize, _fileLength - position); _source.seek(position); byte[] buf = BufferStore.takeBuffer(_blockSize); _source.readBytes(buf, 0, length); System.arraycopy(buf, blockOffset, b, off, lengthToReadInBlock); _cache.update(_cacheName, blockId, buf); BufferStore.putBuffer(buf); }
@Override public void close() throws IOException { String[] files = listAll(); for (String file : files) { _cache.delete(getFileCacheName(file)); } _directory.close(); }