/** * Creates an output stream to write the file content to. */ protected OutputStream doGetOutputStream(boolean bAppend) throws Exception { return file.getContent().getOutputStream(bAppend); }
/** * Returns the last modified time of this file. */ protected long doGetLastModifiedTime() throws Exception { return container.getContent().getLastModifiedTime(); }
public FsFileCollector( FileObject fsRoot ) throws FileSystemException { this.fsRoot = fsRoot; FileSystemManager fileSystemManager = fsRoot.getFileSystem().getFileSystemManager(); FileObject root = fileSystemManager.createVirtualFileSystem( fsRoot ); root.createFolder(); this.root = root; }
public boolean includeFile( FileSelectInfo fileSelectInfo ) throws Exception { FileObject fileObject = fileSelectInfo.getFile(); FileName name = fileObject.getName(); if ( fileType != null && fileObject.getType() != fileType ) { return false; } String relativePath = root.getRelativeName( name ); return matches( relativePath ); }
/** * @see org.apache.commons.vfs.FileSelector#includeFile(org.apache.commons.vfs.FileSelectInfo) */ public boolean includeFile( FileSelectInfo fileInfo ) { String fileName = fileInfo.getFile().getName().getBaseName(); return matcher.matches( fileName, pattern ); }
protected InputStream doGetInputStream() throws Exception { // check file InputStream is = getContainer().getContent().getInputStream(); return wrapInputStream(getName().getURI(), is); }
@Override public boolean includeFile(FileSelectInfo fileInfo) { LOGGER.fine("Uncompressing " + fileInfo.getFile().getName().getFriendlyURI()); return true; } };
public static boolean hasChildren(final FileObject file) throws FileSystemException { assert file != null; if (file.getType().hasChildren()) { FileObject[] children = file.getChildren(); if (children != null && children.length != 0) { return true; } } return false; }
protected void logout() throws TinkException, IOException { VFS.getManager().closeFileSystem(remote.getFileSystem()); }
/** * Constructor * * @param root */ public SFTPRepository(String root) { try { this.root = this.fsManager.resolveFile(root); } catch (FileSystemException e) { e.printStackTrace(); } }
/** * Sets the last-modified time of this file. */ protected void doSetLastModifiedTime(final long modtime) throws Exception { file.getContent().setLastModifiedTime(modtime); }
/** * Returns the attributes of this file. */ protected Map doGetAttributes() throws Exception { return file.getContent().getAttributes(); }
/** * Returns the certificates of this file. */ protected Certificate[] doGetCertificates() throws Exception { return file.getContent().getCertificates(); }
/** * Sets an attribute of this file. */ protected void doSetAttribute(final String atttrName, final Object value) throws Exception { file.getContent().setAttribute(atttrName, value); }
public DelegateFileObject(final FileName name, final AbstractFileSystem fileSystem, final FileObject file) throws FileSystemException { super(name, fileSystem); this.file = file; if (file != null) { file.getFileSystem().addListener(file, this); } }
public String getContentEncoding() { try { return content.getContentInfo().getContentEncoding(); } catch (FileSystemException e) { throw new RuntimeException(e.getMessage()); } }
protected boolean hasParam(FileSystemOptions opts, String name) { if (opts == null) { return false; } return opts.hasOption(getConfigClass(), name); }
/** * Determines if a file or folder should be selected. */ public boolean includeFile(final FileSelectInfo fileInfo) { if (!super.includeFile(fileInfo)) { return false; } return accept(fileInfo); }
protected Object getParam(FileSystemOptions opts, String name) { if (opts == null) { return null; } return opts.getOption(getConfigClass(), name); }
/** * Returns the last-modified time of this file. */ protected long doGetLastModifiedTime() throws Exception { return file.getContent().getLastModifiedTime(); }