/** * Get input stream for a local file and optionally seek to the offset. * @param f path to the file * @param seekOffset offset to seek * @return input stream for read * @throws IOException */ private FileInputStream getDataInputStream(File f, long seekOffset) throws IOException { FileInputStream fis; final FileIoProvider fileIoProvider = getFileIoProvider(); if (NativeIO.isAvailable()) { fis = fileIoProvider.getShareDeleteFileInputStream( getVolume(), f, seekOffset); } else { try { fis = fileIoProvider.openAndSeek(getVolume(), f, seekOffset); } catch (FileNotFoundException fnfe) { throw new IOException("Expected block file at " + f + " does not exist."); } } return fis; }