151152153154155156157158
@Override public InputStream readFile(FileEntry file) { try { return new FileInputStream(FileSystemTools.getAbsolutePath(file, basePath)); } catch (Exception ex) { throw new FileSystemException("Could not read the file ", ex); } }
162163164165166167168169
try { FileInputStream in = new FileInputStream(FileSystemTools.getAbsolutePath(file, basePath)); in.skip(offset); return in; } catch (Exception ex) { throw new FileSystemException("Could not read the file ", ex); } }
170171172173174175176177
@Override public void changeFileModificationTime(FileEntry file, long time) { File f = new File(FileSystemTools.getAbsolutePath(file, basePath)); if (!f.setLastModified(time)) { throw new FileSystemException("Could not change the modification time of the file"); } }
4849505152535455565758
} in.close(); return bytesToHex(digest.digest()); } catch (NoSuchAlgorithmException ex) { throw new FileSystemException("Cannot use MD5"); } catch (IOException ex) { throw new FileSystemException("Error reading file", ex); } }