/** * Adds a junction to this file system. */ public void addJunction(final String junctionPoint, final FileObject targetFile) throws FileSystemException { throw new FileSystemException("vfs.provider/junctions-not-supported.error", rootName); }
/** * Lists the children of the file. */ protected String[] doListChildren() throws Exception { throw new FileSystemException("Not implemented."); }
/** * Retrieves the attribute with the specified name. The default * implementation simply throws an exception. */ public Object getAttribute(final String attrName) throws FileSystemException { throw new FileSystemException("vfs.provider/get-attribute-not-supported.error"); }
/** * Creates access to the file for random i/o. Is only called * if {@link #doGetType} returns {@link FileType#FILE}. * <p/> * <p>It is guaranteed that there are no open output streams for this file * when this method is called. * <p/> */ protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception { throw new FileSystemException("vfs.provider/random-access-not-supported.error"); }
/** * Locates the local file provider. */ private LocalFileProvider getLocalFileProvider() throws FileSystemException { if (localFileProvider == null) { throw new FileSystemException( "vfs.impl/no-local-file-provider.error"); } return localFileProvider; }
/** * Creates a layered file system. This method throws a 'not supported' exception. */ public FileObject createFileSystem(final String scheme, final FileObject file, final FileSystemOptions properties) throws FileSystemException { // Can't create a layered file system throw new FileSystemException("vfs.provider/not-layered-fs.error", scheme); }
/** * Sets the last modified time of this file. Is only called if * {@link #doGetType} does not return {@link FileType#IMAGINARY}. * <p/> * This implementation throws an exception. */ protected void doSetLastModifiedTime(final long modtime) throws Exception { throw new FileSystemException("vfs.provider/set-last-modified-not-supported.error"); }
/** * Sets the filesCache implementation used to cache files */ public void setFilesCache(final FilesCache filesCache) throws FileSystemException { if (init) { throw new FileSystemException("vfs.impl/already-inited.error"); } this.filesCache = filesCache; }
/** * Sets the attribute with the specified name. The default * implementation simply throws an exception. */ public void setAttribute(final String attrName, final Object value) throws FileSystemException { throw new FileSystemException("vfs.provider/set-attribute-not-supported.error"); }
protected ZipFile createZipFile(final File file) throws FileSystemException { try { return new ZipFile(file); } catch (IOException ioe) { throw new FileSystemException("vfs.provider.zip/open-zip-file.error", file, ioe); } }
protected ZipFile createZipFile(File file) throws FileSystemException { try { return new JarFile(file); } catch (IOException ioe) { throw new FileSystemException("vfs.provider.jar/open-jar-file.error", file, ioe); } }
/** * Deletes this file, and all children. */ protected void doDelete() throws Exception { if (!file.delete()) { throw new FileSystemException("vfs.provider.local/delete-file.error", file); } }
/** * Creates this folder. */ protected void doCreateFolder() throws Exception { if (!file.mkdirs()) { throw new FileSystemException("vfs.provider.local/create-folder.error", file); } }
/** * Deletes this file, and all children. */ protected void doDelete() throws Exception { if (!file.deleteAll()) { throw new FileSystemException("vfs.provider.truezip/delete-file.error", file); } }
/** * Creates this folder. */ protected void doCreateFolder() throws Exception { if (!file.mkdirs()) { throw new FileSystemException("vfs.provider.truezip/create-folder.error", file); } }
/** * rename this file */ protected void doRename(final FileObject newfile) throws Exception { LocalFile newLocalFile = (LocalFile) FileObjectUtils.getAbstractFileObject(newfile); if (!file.renameTo(newLocalFile.getLocalFile())) { throw new FileSystemException("vfs.provider.local/rename-file.error", new String[]{file.toString(), newfile.toString()}); } }
/** * Returns the size of the file content (in bytes). */ protected long doGetContentSize() throws Exception { if (attrs == null || (attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_SIZE) == 0) { throw new FileSystemException( "vfs.provider.sftp/unknown-size.error"); } return attrs.getSize(); }
protected long doGetLastModifiedTime() throws Exception { if (attrs == null || (attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_ACMODTIME) == 0) { throw new FileSystemException( "vfs.provider.sftp/unknown-modtime.error"); } return attrs.getMTime() * 1000L; }
/** * Rename this file */ protected void doRename(FileObject newfile) throws Exception { if (!file.renameTo(((TruezipFileObject) newfile).getLocalFile())) { throw new FileSystemException("vfs.provider.truezip/rename-file.error", new String[]{file.toString(), newfile.toString()}); } }
public static UnixFsObject.Directory dirFromFileObject( RelativePath toFile, FileObject fromFile, FileAttributes attributes ) throws FileSystemException { if ( !fromFile.getType().equals( FileType.FOLDER ) ) { throw new FileSystemException( "Not a directory: " + fromFile.getName().getPath() + ", was: " + fromFile.getType() ); } FileContent content = fromFile.getContent(); return UnixFsObject.directory( toFile, new LocalDateTime( content.getLastModifiedTime() ), attributes ); } }