/** * {@inheritDoc} */ @Override public VaultInputSource getInputSource(Entry entry) throws IOException { File file = entry == null ? null : ((OsEntry) entry).file; if (file == null || !file.isFile() || !file.canRead()) { return null; } return new FileInputSource(file); }
switch (file.getStatus()) { case MODIFIED: FileInputSource fis = new FileInputSource(file.getFile()); if (file.isBinary()) { fis.setLineSeparator(LineOutputStream.LS_BINARY); tx.mkdir(path); } else { fis = new FileInputSource(file.getFile()); if (file.isBinary()) { fis.setLineSeparator(LineOutputStream.LS_BINARY);
public VltEntries getEntries() throws VltException { if (entries == null) { if (entriesFile.exists()) { entries = XmlEntries.load(new FileInputSource(entriesFile)); } } return entries; }
public void close() throws IOException, RepositoryException { if (out != null) { out.close(); is = new FileInputSource(tmpFile); tx.setInputSource(is); } }
private void doPut(File local, VaultFile remote) { try { FileInputSource is = new FileInputSource(local); VaultFsTransaction tx = remote.getFileSystem().startTransaction(); tx.modify(remote, is); tx.commit(); System.out.println(local.getName() + " " + local.length() + " bytes."); } catch (IOException e) { throw new ExecutionException("Error while uploading file: " + e); } catch (RepositoryException e) { throw new ExecutionException("Error while uploading file: " + e); } }
private void doAdd(File local, VaultFile parent, String path) { try { FileInputSource is = new FileInputSource(local); VaultFsTransaction tx = parent.getFileSystem().startTransaction(); tx.add(path, is); tx.commit(); System.out.println(local.getName() + " " + local.length() + " bytes."); } catch (IOException e) { throw new ExecutionException("Error while uploading file: " + e); } catch (RepositoryException e) { throw new ExecutionException("Error while uploading file: " + e); } }