Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java Thu Sep 14 19:26:39 2017 @@ -23,16 +23,13 @@ import java.util.List; import org.apache.commons.vfs2.operations.FileOperations; /** - * Represents a file, and is used to access the content and - * structure of the file. + * Represents a file, and is used to access the content and structure of the file. * <p> - * Files are arranged in a hierarchy. Each hierarchy forms a - * <i>file system</i>. A file system represents things like a local OS - * file system, a windows share, an HTTP server, or the contents of a Zip file. + * Files are arranged in a hierarchy. Each hierarchy forms a <i>file system</i>. A file system represents things like a + * local OS file system, a windows share, an HTTP server, or the contents of a Zip file. * <p> - * There are two types of files: <i>Folders</i>, which contain other files, - * and <i>normal files</i>, which contain data, or <i>content</i>. A folder may - * not have any content, and a normal file cannot contain other files. + * There are two types of files: <i>Folders</i>, which contain other files, and <i>normal files</i>, which contain data, + * or <i>content</i>. A folder may not have any content, and a normal file cannot contain other files. * * <h2>File Naming</h2> * @@ -40,22 +37,19 @@ import org.apache.commons.vfs2.operation * * <h2>Reading and Writing a File</h2> * - * Reading and writing a file, and all other operations on the file's - * <i>content</i>, is done using the {@link FileContent} object returned - * by {@link #getContent}. - + * Reading and writing a file, and all other operations on the file's <i>content</i>, is done using the + * {@link FileContent} object returned by {@link #getContent}. + * * <h2>Creating and Deleting a File</h2> * - * A file is created using either {@link #createFolder}, {@link #createFile}, - * or by writing to the file using one of the {@link FileContent} methods. + * A file is created using either {@link #createFolder}, {@link #createFile}, or by writing to the file using one of the + * {@link FileContent} methods. * <p> - * A file is deleted using {@link #delete}. Recursive deletion can be - * done using {@link #delete(FileSelector)}. + * A file is deleted using {@link #delete}. Recursive deletion can be done using {@link #delete(FileSelector)}. * * <h2>Finding Files</h2> * - * Other files in the <i>same</i> file system as this file can be found - * using: + * Other files in the <i>same</i> file system as this file can be found using: * <ul> * <li>{@link #findFiles} to find a set of matching descendants in in the same file system.</li> * <li>{@link #getChildren} and {@link #getChild} to find the children of this file.</li> @@ -72,15 +66,14 @@ import org.apache.commons.vfs2.operation * * <h2>Sorting Files</h2> * - * Files may be sorted using {@link java.util.Arrays#sort(Object[]) Arrays.sort()} - * and {@link java.util.Collections#sort(List) Collections.sort()}. + * Files may be sorted using {@link java.util.Arrays#sort(Object[]) Arrays.sort()} and + * {@link java.util.Collections#sort(List) Collections.sort()}. * * @see FileSystemManager * @see FileContent * @see FileName */ -public interface FileObject extends Comparable<FileObject>, Iterable<FileObject>, Closeable -{ +public interface FileObject extends Comparable<FileObject>, Iterable<FileObject>, Closeable { /** * Queries the file if it is possible to rename it to newfile. * @@ -90,9 +83,8 @@ public interface FileObject extends Comp boolean canRenameTo(FileObject newfile); /** - * Closes this file, and its content. This method is a hint to the - * implementation that it can release any resources associated with - * the file. + * Closes this file, and its content. This method is a hint to the implementation that it can release any resources + * associated with the file. * <p> * The file object can continue to be used after this method is called. * </p> @@ -106,67 +98,61 @@ public interface FileObject extends Comp /** * Copies another file, and all its descendants, to this file. * <p> - * If this file does not exist, it is created. Its parent folder is also - * created, if necessary. If this file does exist, it is deleted first. + * If this file does not exist, it is created. Its parent folder is also created, if necessary. If this file does + * exist, it is deleted first. * </p> * <p> - * This method is not transactional. If it fails and throws an - * exception, this file will potentially only be partially copied. + * This method is not transactional. If it fails and throws an exception, this file will potentially only be + * partially copied. * </p> * - * @param srcFile The source file to copy. + * @param srcFile The source file to copy. * @param selector The selector to use to select which files to copy. - * @throws FileSystemException If this file is read-only, or if the source file does not exist, - * or on error copying the file. + * @throws FileSystemException If this file is read-only, or if the source file does not exist, or on error copying + * the file. */ - void copyFrom(FileObject srcFile, FileSelector selector) - throws FileSystemException; + void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException; /** - * Creates this file, if it does not exist. Also creates any ancestor - * folders which do not exist. This method does nothing if the file - * already exists and is a file. + * Creates this file, if it does not exist. Also creates any ancestor folders which do not exist. This method does + * nothing if the file already exists and is a file. * - * @throws FileSystemException If the file already exists with the wrong type, or the parent - * folder is read-only, or on error creating this file or one of - * its ancestors. + * @throws FileSystemException If the file already exists with the wrong type, or the parent folder is read-only, or + * on error creating this file or one of its ancestors. */ void createFile() throws FileSystemException; /** - * Creates this folder, if it does not exist. Also creates any ancestor - * folders which do not exist. This method does nothing if the folder - * already exists. - * - * @throws FileSystemException If the folder already exists with the wrong type, or the parent - * folder is read-only, or on error creating this folder or one of - * its ancestors. + * Creates this folder, if it does not exist. Also creates any ancestor folders which do not exist. This method does + * nothing if the folder already exists. + * + * @throws FileSystemException If the folder already exists with the wrong type, or the parent folder is read-only, + * or on error creating this folder or one of its ancestors. */ void createFolder() throws FileSystemException; /** - * Deletes this file. Does nothing if this file does not exist of if it is a - * folder that has children. Does not delete any descendants of this file, - * use {@link #delete(FileSelector)} or {@link #deleteAll()} for that. + * Deletes this file. Does nothing if this file does not exist of if it is a folder that has children. Does not + * delete any descendants of this file, use {@link #delete(FileSelector)} or {@link #deleteAll()} for that. * * @return true if this object has been deleted - * @throws FileSystemException If this file is a non-empty folder, or if this file is read-only, - * or on error deleteing this file. + * @throws FileSystemException If this file is a non-empty folder, or if this file is read-only, or on error + * deleteing this file. */ boolean delete() throws FileSystemException; /** - * Deletes all descendants of this file that match a selector. Does - * nothing if this file does not exist. + * Deletes all descendants of this file that match a selector. Does nothing if this file does not exist. * - * <p>This method is not transactional. If it fails and throws an - * exception, this file will potentially only be partially deleted. + * <p> + * This method is not transactional. If it fails and throws an exception, this file will potentially only be + * partially deleted. * </p> * * @param selector The selector to use to select which files to delete. * @return the number of deleted objects - * @throws FileSystemException If this file or one of its descendants is read-only, or on error - * deleting this file or one of its descendants. + * @throws FileSystemException If this file or one of its descendants is read-only, or on error deleting this file + * or one of its descendants. */ int delete(FileSelector selector) throws FileSystemException; @@ -192,52 +178,50 @@ public interface FileObject extends Comp * Finds the set of matching descendants of this file, in depthwise order. * * @param selector The selector to use to select matching files. - * @return The matching files. The files are returned in depthwise order - * (that is, a child appears in the list before its parent). + * @return The matching files. The files are returned in depthwise order (that is, a child appears in the list + * before its parent). * @throws FileSystemException if an error occurs. */ FileObject[] findFiles(FileSelector selector) throws FileSystemException; /** - * Finds the set of matching descendants of this file. - * - * @param selector the selector used to determine if the file should be selected - * @param depthwise controls the ordering in the list. e.g. deepest first - * @param selected container for selected files. list needs not to be empty. - * @throws FileSystemException if an error occurs. - */ + * Finds the set of matching descendants of this file. + * + * @param selector the selector used to determine if the file should be selected + * @param depthwise controls the ordering in the list. e.g. deepest first + * @param selected container for selected files. list needs not to be empty. + * @throws FileSystemException if an error occurs. + */ void findFiles(FileSelector selector, boolean depthwise, List<FileObject> selected) throws FileSystemException; /** - * Returns a child of this file. Note that this method returns {@code null} - * when the child does not exist. This differs from - * {@link #resolveFile(String, NameScope)} which never returns null. + * Returns a child of this file. Note that this method returns {@code null} when the child does not exist. This + * differs from {@link #resolveFile(String, NameScope)} which never returns null. * * @param name The name of the child. * @return The child, or null if there is no such child. - * @throws FileSystemException If this file does not exist, or is not a folder, or on error - * determining this file's children. + * @throws FileSystemException If this file does not exist, or is not a folder, or on error determining this file's + * children. */ FileObject getChild(String name) throws FileSystemException; /** * Lists the children of this file. * - * @return An array containing the children of this file. The array is - * unordered. If the file does not have any children, a zero-length - * array is returned. This method never returns null. - * @throws FileSystemException If this file does not exist, or is not a folder, or on error - * listing this file's children. + * @return An array containing the children of this file. The array is unordered. If the file does not have any + * children, a zero-length array is returned. This method never returns null. + * @throws FileSystemException If this file does not exist, or is not a folder, or on error listing this file's + * children. */ FileObject[] getChildren() throws FileSystemException; /** - * Returns this file's content. The {@link FileContent} returned by this - * method can be used to read and write the content of the file. + * Returns this file's content. The {@link FileContent} returned by this method can be used to read and write the + * content of the file. * - * <p>This method can be called if the file does not exist, and - * the returned {@link FileContent} can be used to create the file - * by writing its content. + * <p> + * This method can be called if the file does not exist, and the returned {@link FileContent} can be used to create + * the file by writing its content. * </p> * * @return This file's content. @@ -268,15 +252,13 @@ public interface FileObject extends Comp /** * Returns the folder that contains this file. * - * @return The folder that contains this file. Returns null if this file is - * the root of a file system. + * @return The folder that contains this file. Returns null if this file is the root of a file system. * @throws FileSystemException On error finding the file's parent. */ FileObject getParent() throws FileSystemException; /** - * Returns the receiver as a URI String for public display, like, without a - * password. + * Returns the receiver as a URI String for public display, like, without a password. * * @return A URI String without a password, never {@code null}. */ @@ -285,7 +267,7 @@ public interface FileObject extends Comp /** * Returns this file's type. * - * @return One of the {@link FileType} constants. Never returns null. + * @return One of the {@link FileType} constants. Never returns null. * @throws FileSystemException On error determining the file's type. */ FileType getType() throws FileSystemException; @@ -374,11 +356,10 @@ public interface FileObject extends Comp * </p> * * @param destFile the New filename. - * @throws FileSystemException If this file is read-only, or if the source file does not exist, - * or on error copying the file. + * @throws FileSystemException If this file is read-only, or if the source file does not exist, or on error copying + * the file. */ - void moveTo(FileObject destFile) - throws FileSystemException; + void moveTo(FileObject destFile) throws FileSystemException; /** * This will prepare the fileObject to get resynchronized with the underlying file system if required. @@ -388,11 +369,9 @@ public interface FileObject extends Comp void refresh() throws FileSystemException; /** - * Finds a file, relative to this file. Equivalent to calling - * {@code resolveFile( path, NameScope.FILE_SYSTEM )}. + * Finds a file, relative to this file. Equivalent to calling {@code resolveFile( path, NameScope.FILE_SYSTEM )}. * - * @param path The path of the file to locate. Can either be a relative - * path or an absolute path. + * @param path The path of the file to locate. Can either be a relative path or an absolute path. * @return The file. * @throws FileSystemException On error parsing the path, or on error finding the file. */ @@ -408,34 +387,26 @@ public interface FileObject extends Comp * @return The file. * @throws FileSystemException On error parsing the path, or on error finding the file. */ - FileObject resolveFile(String name, NameScope scope) - throws FileSystemException; + FileObject resolveFile(String name, NameScope scope) throws FileSystemException; /** * Sets the owner's (or everybody's) write permission. * - * @param executable - * True to allow read access, false to disallow. - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param executable True to allow read access, false to disallow. + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded. - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setExecutable(boolean executable, boolean ownerOnly) throws FileSystemException; - /** * Sets the owner's (or everybody's) read permission. * - * @param readable - * True to allow read access, false to disallow - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param readable True to allow read access, false to disallow + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setReadable(boolean readable, boolean ownerOnly) throws FileSystemException; @@ -443,13 +414,10 @@ public interface FileObject extends Comp /** * Sets the owner's (or everybody's) write permission. * - * @param writable - * True to allow read access, false to disallow - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param writable True to allow read access, false to disallow + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setWritable(boolean writable, boolean ownerOnly) throws FileSystemException;
Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java Thu Sep 14 19:26:39 2017 @@ -17,27 +17,28 @@ package org.apache.commons.vfs2; /** - * Information about a file, that is used to select files during the - * traversal of a hierarchy. + * Information about a file, that is used to select files during the traversal of a hierarchy. * <p> * TODO - Rename this interface, as it is used by both FileSelector and FileVisitor. */ -public interface FileSelectInfo -{ +public interface FileSelectInfo { /** * Returns the base folder of the traversal. + * * @return FileObject representing the base folder. */ FileObject getBaseFolder(); /** * Returns the file (or folder) to be considered. + * * @return The FileObject. */ FileObject getFile(); /** * Returns the depth of the file relative to the base folder. + * * @return The depth of the file relative to the base folder. */ int getDepth(); Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java Thu Sep 14 19:26:39 2017 @@ -21,32 +21,26 @@ package org.apache.commons.vfs2; * * @see Selectors */ -public interface FileSelector -{ +public interface FileSelector { /** - * Determines if a file or folder should be selected. This method is - * called in depthwise order (that is, it is called for the children - * of a folder before it is called for the folder itself). + * Determines if a file or folder should be selected. This method is called in depthwise order (that is, it is + * called for the children of a folder before it is called for the folder itself). * * @param fileInfo the file or folder to select. * @return true if the file should be selected. * @throws Exception if an error occurs. */ - boolean includeFile(FileSelectInfo fileInfo) - throws Exception; + boolean includeFile(FileSelectInfo fileInfo) throws Exception; /** - * Determines whether a folder should be traversed. If this method returns - * true, {@link #includeFile} is called for each of the children of - * the folder, and each of the child folders is recursively traversed. + * Determines whether a folder should be traversed. If this method returns true, {@link #includeFile} is called for + * each of the children of the folder, and each of the child folders is recursively traversed. * <p> - * This method is called on a folder before {@link #includeFile} - * is called. + * This method is called on a folder before {@link #includeFile} is called. * * @param fileInfo the file or folder to select. * @return true if the folder should be traversed. * @throws Exception if an error occurs. */ - boolean traverseDescendents(FileSelectInfo fileInfo) - throws Exception; + boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception; } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java Thu Sep 14 19:26:39 2017 @@ -21,24 +21,25 @@ import java.io.File; /** * A file system, made up of a hierarchy of files. */ -public interface FileSystem -{ +public interface FileSystem { /** * Returns the root file of this file system. + * * @return The root FileObject. * @throws FileSystemException if an error occurs. */ FileObject getRoot() throws FileSystemException; /** - * Returns the name of the root file of this file system. The root name always - * contains a path String of "/". + * Returns the name of the root file of this file system. The root name always contains a path String of "/". + * * @return the root FileName. */ FileName getRootName(); /** * The root URI passed as a file system option or obtained from the rootName. + * * @return The root URI. */ String getRootURI(); @@ -49,9 +50,8 @@ public interface FileSystem * TODO - Move this to another interface, so that set of capabilities can be queried. * * @param capability The capability to check for. - * @return true if this filesystem has the requested capability. - * Note that not all files in the file system may have the - * capability. + * @return true if this filesystem has the requested capability. Note that not all files in the file system may have + * the capability. */ boolean hasCapability(Capability capability); @@ -67,36 +67,32 @@ public interface FileSystem * Gets the value of an attribute of the file system. * <p> * TODO - change to {@code Map getAttributes()} instead?<br> - * TODO - define the standard attribute names, and define which attrs - * are guaranteed to be present. + * TODO - define the standard attribute names, and define which attrs are guaranteed to be present. * * @param attrName The name of the attribute. * @return The value of the attribute. - * @throws org.apache.commons.vfs2.FileSystemException - * If the file does not exist, or is being written, or if the - * attribute is unknown. + * @throws org.apache.commons.vfs2.FileSystemException If the file does not exist, or is being written, or if the + * attribute is unknown. * @see org.apache.commons.vfs2.FileContent#getAttribute */ Object getAttribute(String attrName) throws FileSystemException; /** - * Sets the value of an attribute of the file's content. Creates the - * file if it does not exist. + * Sets the value of an attribute of the file's content. Creates the file if it does not exist. * * @param attrName The name of the attribute. - * @param value The value of the attribute. - * @throws FileSystemException If the file is read-only, or is being read, or if the attribute - * is not supported, or on error setting the attribute. + * @param value The value of the attribute. + * @throws FileSystemException If the file is read-only, or is being read, or if the attribute is not supported, or + * on error setting the attribute. * @see FileContent#setAttribute */ - void setAttribute(String attrName, Object value) - throws FileSystemException; + void setAttribute(String attrName, Object value) throws FileSystemException; /** * Finds a file in this file system. * * @param name The name of the file. - * @return The file. Never returns null. + * @return The file. Never returns null. * @throws FileSystemException if an error occurs. */ FileObject resolveFile(FileName name) throws FileSystemException; @@ -104,8 +100,8 @@ public interface FileSystem /** * Finds a file in this file system. * - * @param name The name of the file. This must be an absolute path. - * @return The file. Never returns null. + * @param name The name of the file. This must be an absolute path. + * @return The file. Never returns null. * @throws FileSystemException if an error occurs. */ FileObject resolveFile(String name) throws FileSystemException; @@ -113,7 +109,7 @@ public interface FileSystem /** * Adds a listener on a file in this file system. * - * @param file The file to attach the listener to. + * @param file The file to attach the listener to. * @param listener The listener to add. */ void addListener(FileObject file, FileListener listener); @@ -121,24 +117,21 @@ public interface FileSystem /** * Removes a listener from a file in this file system. * - * @param file The file to remove the listener from. + * @param file The file to remove the listener from. * @param listener The listener to remove. */ void removeListener(FileObject file, FileListener listener); /** - * Adds a junction to this file system. A junction is a link that attaches - * the supplied file to a point in this file system, making it look like - * part of the file system. + * Adds a junction to this file system. A junction is a link that attaches the supplied file to a point in this file + * system, making it look like part of the file system. * * @param junctionPoint The point in this file system to add the junction. - * @param targetFile The file to link to. - * @throws FileSystemException If this file system does not support junctions, or the junction - * point or target file is invalid (the file system may not support - * nested junctions, for example). + * @param targetFile The file to link to. + * @throws FileSystemException If this file system does not support junctions, or the junction point or target file + * is invalid (the file system may not support nested junctions, for example). */ - void addJunction(String junctionPoint, FileObject targetFile) - throws FileSystemException; + void addJunction(String junctionPoint, FileObject targetFile) throws FileSystemException; /** * Removes a junction from this file system. @@ -149,33 +142,31 @@ public interface FileSystem void removeJunction(String junctionPoint) throws FileSystemException; /** - * Creates a temporary local copy of a file and its descendants. If - * this file is already a local file, a copy is not made. + * Creates a temporary local copy of a file and its descendants. If this file is already a local file, a copy is not + * made. * <p> - * Note that the local copy may include additonal files, that were - * not selected by the given selector. + * Note that the local copy may include additonal files, that were not selected by the given selector. * <p> - * TODO - Add options to indicate whether the caller is happy to deal with - * extra files being present locally (eg if the file has been - * replicated previously), or whether the caller expects only - * the selected files to be present. + * TODO - Add options to indicate whether the caller is happy to deal with extra files being present locally (eg if + * the file has been replicated previously), or whether the caller expects only the selected files to be present. * - * @param file The file to replicate. + * @param file The file to replicate. * @param selector The selector to use to select the files to replicate. * @return The local copy of this file. * @throws FileSystemException If this file does not exist, or on error replicating the file. */ - File replicateFile(FileObject file, FileSelector selector) - throws FileSystemException; + File replicateFile(FileObject file, FileSelector selector) throws FileSystemException; /** * Returns the FileSystemOptions used to instantiate this filesystem. + * * @return The FileSystemOptions. */ FileSystemOptions getFileSystemOptions(); /** * Returns a reference to the FileSytemManager. + * * @return The FileSystemManager. */ FileSystemManager getFileSystemManager(); @@ -183,13 +174,11 @@ public interface FileSystem /** * Returns the accuracy of the last modification time. * <p> - * The local file provider is not very smart in figuring this out, for remote - * access to file systems the providers typically don't know the value of the underlying - * real file system. - * - * @return the accuracy of the last modification time in milliseconds. A - * value of 0 means perfectly accurate, anything {@literal > 0} might be off - * by this value. For example, sftp has an accuracy of 1000 ms. + * The local file provider is not very smart in figuring this out, for remote access to file systems the providers + * typically don't know the value of the underlying real file system. + * + * @return the accuracy of the last modification time in milliseconds. A value of 0 means perfectly accurate, + * anything {@literal > 0} might be off by this value. For example, sftp has an accuracy of 1000 ms. */ double getLastModTimeAccuracy(); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java Thu Sep 14 19:26:39 2017 @@ -19,8 +19,7 @@ package org.apache.commons.vfs2; /** * Abstract class which has the right to fill FileSystemOptions. */ -public abstract class FileSystemConfigBuilder -{ +public abstract class FileSystemConfigBuilder { /** Default prefix to use when resolving system properties */ private static final String PREFIX = "vfs."; @@ -35,8 +34,7 @@ public abstract class FileSystemConfigBu * * @since 1.0 */ - protected FileSystemConfigBuilder() - { + protected FileSystemConfigBuilder() { this.prefix = PREFIX; } @@ -47,8 +45,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected FileSystemConfigBuilder(final String component) - { + protected FileSystemConfigBuilder(final String component) { this.prefix = PREFIX + component; } @@ -60,8 +57,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - public void setRootURI(final FileSystemOptions opts, final String rootURI) - { + public void setRootURI(final FileSystemOptions opts, final String rootURI) { setParam(opts, ROOTURI, rootURI); } @@ -73,8 +69,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - public String getRootURI(final FileSystemOptions opts) - { + public String getRootURI(final FileSystemOptions opts) { return getString(opts, ROOTURI); } @@ -87,8 +82,7 @@ public abstract class FileSystemConfigBu * * @since 2.1 */ - protected void setParam(final FileSystemOptions opts, final String name, final boolean value) - { + protected void setParam(final FileSystemOptions opts, final String name, final boolean value) { setParam(opts, name, Boolean.valueOf(value)); } @@ -101,8 +95,7 @@ public abstract class FileSystemConfigBu * * @since 1.0 */ - protected void setParam(final FileSystemOptions opts, final String name, final Object value) - { + protected void setParam(final FileSystemOptions opts, final String name, final Object value) { opts.setOption(getConfigClass(), name, value); } @@ -115,10 +108,8 @@ public abstract class FileSystemConfigBu * * @since 1.0 */ - protected Object getParam(final FileSystemOptions opts, final String name) - { - if (opts == null) - { + protected Object getParam(final FileSystemOptions opts, final String name) { + if (opts == null) { return null; } @@ -134,8 +125,7 @@ public abstract class FileSystemConfigBu * * @since 1.0 */ - protected boolean hasParam(final FileSystemOptions opts, final String name) - { + protected boolean hasParam(final FileSystemOptions opts, final String name) { return opts != null && opts.hasOption(getConfigClass(), name); } @@ -148,8 +138,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected boolean hasObject(final FileSystemOptions opts, final String name) - { + protected boolean hasObject(final FileSystemOptions opts, final String name) { return hasParam(opts, name) || System.getProperties().containsKey(toPropertyKey(name)); } @@ -163,8 +152,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Boolean getBoolean(final FileSystemOptions opts, final String name) - { + protected Boolean getBoolean(final FileSystemOptions opts, final String name) { return getBoolean(opts, name, null); } @@ -179,8 +167,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected boolean getBoolean(final FileSystemOptions opts, final String name, final boolean defaultValue) - { + protected boolean getBoolean(final FileSystemOptions opts, final String name, final boolean defaultValue) { return getBoolean(opts, name, Boolean.valueOf(defaultValue)).booleanValue(); } @@ -195,14 +182,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Boolean getBoolean(final FileSystemOptions opts, final String name, final Boolean defaultValue) - { + protected Boolean getBoolean(final FileSystemOptions opts, final String name, final Boolean defaultValue) { Boolean value = (Boolean) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Boolean.valueOf(str); @@ -220,8 +204,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Byte getByte(final FileSystemOptions opts, final String name) - { + protected Byte getByte(final FileSystemOptions opts, final String name) { return getByte(opts, name, null); } @@ -236,8 +219,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected byte getByte(final FileSystemOptions opts, final String name, final byte defaultValue) - { + protected byte getByte(final FileSystemOptions opts, final String name, final byte defaultValue) { return getByte(opts, name, Byte.valueOf(defaultValue)).byteValue(); } @@ -251,14 +233,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Byte getByte(final FileSystemOptions opts, final String name, final Byte defaultValue) - { + protected Byte getByte(final FileSystemOptions opts, final String name, final Byte defaultValue) { Byte value = (Byte) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Byte.valueOf(str); @@ -276,8 +255,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Character getCharacter(final FileSystemOptions opts, final String name) - { + protected Character getCharacter(final FileSystemOptions opts, final String name) { return getCharacter(opts, name, null); } @@ -292,8 +270,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected char getCharacter(final FileSystemOptions opts, final String name, final char defaultValue) - { + protected char getCharacter(final FileSystemOptions opts, final String name, final char defaultValue) { return getCharacter(opts, name, new Character(defaultValue)).charValue(); } @@ -307,14 +284,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Character getCharacter(final FileSystemOptions opts, final String name, final Character defaultValue) - { + protected Character getCharacter(final FileSystemOptions opts, final String name, final Character defaultValue) { Character value = (Character) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = new Character(str.charAt(0)); @@ -332,8 +306,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Double getDouble(final FileSystemOptions opts, final String name) - { + protected Double getDouble(final FileSystemOptions opts, final String name) { return getDouble(opts, name, null); } @@ -348,8 +321,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected double getDouble(final FileSystemOptions opts, final String name, final double defaultValue) - { + protected double getDouble(final FileSystemOptions opts, final String name, final double defaultValue) { return getDouble(opts, name, new Double(defaultValue)).doubleValue(); } @@ -363,14 +335,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Double getDouble(final FileSystemOptions opts, final String name, final Double defaultValue) - { + protected Double getDouble(final FileSystemOptions opts, final String name, final Double defaultValue) { Double value = (Double) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = Double.valueOf(str); @@ -384,15 +353,14 @@ public abstract class FileSystemConfigBu * @param <E> enumeration type * @param enumClass class of enumeration type * @param opts file system options to work with - * @param name the option name * + * @param name the option name * * @return the option in {@code opts} or system properties, otherwise null * @see #getEnum(Class, FileSystemOptions, String, Enum) * @throws IllegalArgumentException if option value is not a known enumeration. * * @since 2.1 */ - protected <E extends Enum<E>> E getEnum(final Class<E> enumClass, final FileSystemOptions opts, final String name) - { + protected <E extends Enum<E>> E getEnum(final Class<E> enumClass, final FileSystemOptions opts, final String name) { return this.<E>getEnum(enumClass, opts, name, null); } @@ -410,16 +378,13 @@ public abstract class FileSystemConfigBu * * @since 2.1 */ - protected <E extends Enum<E>> E getEnum(final Class<E> enumClass, final FileSystemOptions opts, - final String name, final E defaultValue) - { + protected <E extends Enum<E>> E getEnum(final Class<E> enumClass, final FileSystemOptions opts, final String name, + final E defaultValue) { @SuppressWarnings("unchecked") E value = (E) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Enum.valueOf(enumClass, str); @@ -438,8 +403,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Float getFloat(final FileSystemOptions opts, final String name) - { + protected Float getFloat(final FileSystemOptions opts, final String name) { return getFloat(opts, name, null); } @@ -455,8 +419,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected float getFloat(final FileSystemOptions opts, final String name, final float defaultValue) - { + protected float getFloat(final FileSystemOptions opts, final String name, final float defaultValue) { return getFloat(opts, name, new Float(defaultValue)).floatValue(); } @@ -471,14 +434,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Float getFloat(final FileSystemOptions opts, final String name, final Float defaultValue) - { + protected Float getFloat(final FileSystemOptions opts, final String name, final Float defaultValue) { Float value = (Float) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = Float.valueOf(str); @@ -497,8 +457,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Integer getInteger(final FileSystemOptions opts, final String name) - { + protected Integer getInteger(final FileSystemOptions opts, final String name) { return getInteger(opts, name, null); } @@ -514,8 +473,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected int getInteger(final FileSystemOptions opts, final String name, final int defaultValue) - { + protected int getInteger(final FileSystemOptions opts, final String name, final int defaultValue) { return getInteger(opts, name, Integer.valueOf(defaultValue)).intValue(); } @@ -530,14 +488,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Integer getInteger(final FileSystemOptions opts, final String name, final Integer defaultValue) - { + protected Integer getInteger(final FileSystemOptions opts, final String name, final Integer defaultValue) { Integer value = (Integer) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Integer.valueOf(str); @@ -556,8 +511,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Long getLong(final FileSystemOptions opts, final String name) - { + protected Long getLong(final FileSystemOptions opts, final String name) { return getLong(opts, name, null); } @@ -573,8 +527,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected long getLong(final FileSystemOptions opts, final String name, final long defaultValue) - { + protected long getLong(final FileSystemOptions opts, final String name, final long defaultValue) { return getLong(opts, name, Long.valueOf(defaultValue)).longValue(); } @@ -589,14 +542,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Long getLong(final FileSystemOptions opts, final String name, final Long defaultValue) - { + protected Long getLong(final FileSystemOptions opts, final String name, final Long defaultValue) { Long value = (Long) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Long.valueOf(str); @@ -615,8 +565,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Short getShort(final FileSystemOptions opts, final String name) - { + protected Short getShort(final FileSystemOptions opts, final String name) { return getShort(opts, name, null); } @@ -632,8 +581,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected short getShort(final FileSystemOptions opts, final String name, final short defaultValue) - { + protected short getShort(final FileSystemOptions opts, final String name, final short defaultValue) { return getShort(opts, name, Short.valueOf(defaultValue)).shortValue(); } @@ -648,14 +596,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected Short getShort(final FileSystemOptions opts, final String name, final Short defaultValue) - { + protected Short getShort(final FileSystemOptions opts, final String name, final Short defaultValue) { Short value = (Short) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Short.valueOf(str); @@ -673,8 +618,7 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected String getString(final FileSystemOptions opts, final String name) - { + protected String getString(final FileSystemOptions opts, final String name) { return getString(opts, name, null); } @@ -688,14 +632,11 @@ public abstract class FileSystemConfigBu * * @since 2.0 */ - protected String getString(final FileSystemOptions opts, final String name, final String defaultValue) - { + protected String getString(final FileSystemOptions opts, final String name, final String defaultValue) { String value = (String) getParam(opts, name); - if (value == null) - { + if (value == null) { value = getProperty(name); - if (value == null) - { + if (value == null) { return defaultValue; } } @@ -719,8 +660,7 @@ public abstract class FileSystemConfigBu * * @since 2.1 */ - private String toPropertyKey(final String name) - { + private String toPropertyKey(final String name) { return this.prefix + name; } @@ -732,8 +672,7 @@ public abstract class FileSystemConfigBu * * @since 2.1 */ - private String getProperty(final String name) - { + private String getProperty(final String name) { return System.getProperty(toPropertyKey(name)); } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java Thu Sep 14 19:26:39 2017 @@ -25,9 +25,7 @@ import org.apache.commons.vfs2.util.Mess /** * Thrown for file system errors. */ -public class FileSystemException - extends IOException -{ +public class FileSystemException extends IOException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ @@ -49,34 +47,29 @@ public class FileSystemException * * @param code the error code of the message. */ - public FileSystemException(final String code) - { + public FileSystemException(final String code) { this(code, null, (Object[]) null); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. + * @param code the error code of the message. * @param info0 one context information. */ - public FileSystemException(final String code, final Object info0) - { - this(code, null, new Object[]{info0}); + public FileSystemException(final String code, final Object info0) { + this(code, null, new Object[] { info0 }); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info0 one context information. + * @param code the error code of the message. + * @param info0 one context information. * @param throwable the cause. */ - public FileSystemException(final String code, - final Object info0, - final Throwable throwable) - { - this(code, throwable, new Object[]{info0}); + public FileSystemException(final String code, final Object info0, final Throwable throwable) { + this(code, throwable, new Object[] { info0 }); } /** @@ -85,8 +78,7 @@ public class FileSystemException * @param code the error code of the message. * @param info array of complementary info (context). */ - public FileSystemException(final String code, final Object... info) - { + public FileSystemException(final String code, final Object... info) { this(code, null, info); } @@ -96,54 +88,42 @@ public class FileSystemException * @param code the error code of the message. * @param throwable the original cause */ - public FileSystemException(final String code, final Throwable throwable) - { + public FileSystemException(final String code, final Throwable throwable) { this(code, throwable, (Object[]) null); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info array of complementary info (context). + * @param code the error code of the message. + * @param info array of complementary info (context). * @param throwable the cause. * @deprecated Use instead {@link #FileSystemException(String, Throwable, Object[])}. Will be removed in 3.0. */ @Deprecated - public FileSystemException(final String code, - final Object[] info, - final Throwable throwable) - { + public FileSystemException(final String code, final Object[] info, final Throwable throwable) { this(code, throwable, info); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info array of complementary info (context). + * @param code the error code of the message. + * @param info array of complementary info (context). * @param throwable the cause. */ - public FileSystemException(final String code, - final Throwable throwable, - final Object... info) - { + public FileSystemException(final String code, final Throwable throwable, final Object... info) { super(code, throwable); - if (info == null) - { + if (info == null) { this.info = new String[0]; - } - else - { + } else { this.info = new String[info.length]; - for (int i = 0; i < info.length; i++) - { + for (int i = 0; i < info.length; i++) { String value = String.valueOf(info[i]); // mask passwords (VFS-169) final Matcher urlMatcher = URL_PATTERN.matcher(value); - if (urlMatcher.find()) - { + if (urlMatcher.find()) { final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(value); value = pwdMatcher.replaceFirst(":***@"); } @@ -157,40 +137,35 @@ public class FileSystemException * * @param throwable the root cause to wrap. */ - public FileSystemException(final Throwable throwable) - { + public FileSystemException(final Throwable throwable) { this(throwable.getMessage(), throwable, (Object[]) null); } /** * Retrieves message from bundle. + * * @return The exception message. */ @Override - public String getMessage() - { + public String getMessage() { return Messages.getString(super.getMessage(), (Object[]) getInfo()); } /** - * Retrieves error code of the exception. - * Could be used as key for internationalization. + * Retrieves error code of the exception. Could be used as key for internationalization. * * @return the code. */ - public String getCode() - { + public String getCode() { return super.getMessage(); } /** - * Retrieves array of complementary info (context). - * Could be used as parameter for internationalization. + * Retrieves array of complementary info (context). Could be used as parameter for internationalization. * * @return the context info. */ - public String[] getInfo() - { + public String[] getInfo() { return info; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java Thu Sep 14 19:26:39 2017 @@ -27,37 +27,28 @@ import org.apache.commons.logging.Log; import org.apache.commons.vfs2.operations.FileOperationProvider; /** - * A FileSystemManager manages a set of file systems. This interface is - * used to locate a {@link FileObject} by name from one of those file systems. + * A FileSystemManager manages a set of file systems. This interface is used to locate a {@link FileObject} by name from + * one of those file systems. * <p> - * To locate a {@link FileObject}, use one of the {@code resolveFile()} - * methods. + * To locate a {@link FileObject}, use one of the {@code resolveFile()} methods. * * <h2><a name="naming">File Naming</a></h2> * * A file system manager can recognise several types of file names: * <ul> - * <li>Absolute URI. These must start with a scheme, such as - * {@code file:} or {@code ftp:}, followed by a scheme dependent - * file name. Some examples: {@code file:/c:/somefile} or - * {@code ftp://somewhere.org/somefile}.</li> - * <li>Absolute local file name. For example, - * {@code /home/someuser/a-file} or {@code c:\dir\somefile.html}. - * Elements in the name can be separated using any of the following - * characters: {@code /}, {@code \}, or the native file separator - * character. For example, the following file names are the same: - * {@code c:\somedir\somefile.xml} and {@code c:/somedir/somefile.xml}.</li> - * <li>Relative path. For example: {@code ../somefile} or - * {@code somedir/file.txt}. The file system manager resolves relative - * paths against its <i>base file</i>. Elements in the relative path can be - * separated using {@code /}, {@code \}, or file system specific - * separator characters. Relative paths may also contain {@code ..} and - * {@code .} elements. See {@link FileObject#resolveFile} for more - * details.</li> + * <li>Absolute URI. These must start with a scheme, such as {@code file:} or {@code ftp:}, followed by a scheme + * dependent file name. Some examples: {@code file:/c:/somefile} or {@code ftp://somewhere.org/somefile}.</li> + * <li>Absolute local file name. For example, {@code /home/someuser/a-file} or {@code c:\dir\somefile.html}. Elements in + * the name can be separated using any of the following characters: {@code /}, {@code \}, or the native file separator + * character. For example, the following file names are the same: {@code c:\somedir\somefile.xml} and + * {@code c:/somedir/somefile.xml}.</li> + * <li>Relative path. For example: {@code ../somefile} or {@code somedir/file.txt}. The file system manager resolves + * relative paths against its <i>base file</i>. Elements in the relative path can be separated using {@code /}, + * {@code \}, or file system specific separator characters. Relative paths may also contain {@code ..} and {@code .} + * elements. See {@link FileObject#resolveFile} for more details.</li> * </ul> */ -public interface FileSystemManager -{ +public interface FileSystemManager { /** * Returns the base file used to resolve relative paths. * @@ -67,59 +58,51 @@ public interface FileSystemManager FileObject getBaseFile() throws FileSystemException; /** - * Locates a file by name. Equivalent to calling - * {@code resolveFile(getBaseFile(), name)}. + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. * * @param name The name of the file. - * @return The file. Never returns null. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(String name) throws FileSystemException; /** - * Locates a file by name. Equivalent to calling - * {@code resolveFile(getBaseFile(), name)}. + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. * - * @param name The name of the file. - * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. - * All files that are later resolved relative to the - * returned {@code FileObject} share the options. - * @return The file. Never returns null. + * @param name The name of the file. + * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. All files that are later resolved + * relative to the returned {@code FileObject} share the options. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ - FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) - throws FileSystemException; + FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) throws FileSystemException; /** - * Locates a file by name. The name is resolved as described - * <a href="#naming">above</a>. That is, the name can be either - * an absolute URI, an absolute file name, or a relative path to - * be resolved against {@code baseFile}. + * Locates a file by name. The name is resolved as described <a href="#naming">above</a>. That is, the name can be + * either an absolute URI, an absolute file name, or a relative path to be resolved against {@code baseFile}. * <p> * Note that the file does not have to exist when this method is called. * - * @param baseFile The base file to use to resolve relative paths. - * May be null if the name is an absolute file name. - * @param name The name of the file. - * @return The file. Never returns null. + * @param baseFile The base file to use to resolve relative paths. May be null if the name is an absolute file name. + * @param name The name of the file. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(FileObject baseFile, String name) throws FileSystemException; /** - * Locates a file by name. See {@link #resolveFile(FileObject, String)} - * for details. + * Locates a file by name. See {@link #resolveFile(FileObject, String)} for details. * - * @param baseFile The base file to use to resolve relative paths. - * Must not be {@code null}, not even if the <i>name</i> is absolute. - * @param name The name of the file. - * @return The file. Never returns null. + * @param baseFile The base file to use to resolve relative paths. Must not be {@code null}, not even if the + * <i>name</i> is absolute. + * @param name The name of the file. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(File baseFile, String name) throws FileSystemException; /** - * Resolves a name, relative to this file name. Equivalent to calling + * Resolves a name, relative to this file name. Equivalent to calling * {@code resolveName( path, NameScope.FILE_SYSTEM )}. * * @param root the base filename @@ -130,40 +113,37 @@ public interface FileSystemManager FileName resolveName(FileName root, String name) throws FileSystemException; /** - * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} - * for a description of how names are resolved. + * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} for a description of how names are + * resolved. * * @param root the base filename - * @param name The name to resolve. + * @param name The name to resolve. * @param scope The {@link NameScope} to use when resolving the name. * @return A {@link FileName} object representing the resolved file name. * @throws FileSystemException If the name is invalid. */ - FileName resolveName(FileName root, String name, NameScope scope) - throws FileSystemException; + FileName resolveName(FileName root, String name, NameScope scope) throws FileSystemException; /** * Converts a local file into a {@link FileObject}. * * @param file The file to convert. - * @return The {@link FileObject} that represents the local file. Never - * returns null. + * @return The {@link FileObject} that represents the local file. Never returns null. * @throws FileSystemException On error converting the file. */ FileObject toFileObject(File file) throws FileSystemException; /** - * Creates a layered file system. A layered file system is a file system - * that is created from the contents of a file, such as a zip or tar file. + * Creates a layered file system. A layered file system is a file system that is created from the contents of a + * file, such as a zip or tar file. * - * @param provider The name of the file system provider to use. This name - * is the same as the scheme used in URI to identify the provider. - * @param file The file to use to create the file system. + * @param provider The name of the file system provider to use. This name is the same as the scheme used in URI to + * identify the provider. + * @param file The file to use to create the file system. * @return The root file of the new file system. * @throws FileSystemException On error creating the file system. */ - FileObject createFileSystem(String provider, FileObject file) - throws FileSystemException; + FileObject createFileSystem(String provider, FileObject file) throws FileSystemException; /** * Closes the given filesystem. @@ -175,8 +155,8 @@ public interface FileSystemManager void closeFileSystem(FileSystem filesystem); /** - * Creates a layered file system. A layered file system is a file system - * that is created from the contents of a file, such as a zip or tar file. + * Creates a layered file system. A layered file system is a file system that is created from the contents of a + * file, such as a zip or tar file. * * @param file The file to use to create the file system. * @return The root file of the new file system. @@ -185,18 +165,16 @@ public interface FileSystemManager FileObject createFileSystem(FileObject file) throws FileSystemException; /** - * Creates an empty virtual file system. Can be populated by adding - * junctions to it. + * Creates an empty virtual file system. Can be populated by adding junctions to it. * - * @param rootUri The root URI to use for the new file system. Can be null. + * @param rootUri The root URI to use for the new file system. Can be null. * @return The root file of the new file system. * @throws FileSystemException if an error occurs creating the VirtualFileSystem. */ FileObject createVirtualFileSystem(String rootUri) throws FileSystemException; /** - * Creates a virtual file system. The file system will contain a junction - * at the fs root to the supplied root file. + * Creates a virtual file system. The file system will contain a junction at the fs root to the supplied root file. * * @param rootFile The root file to backs the file system. * @return The root of the new file system. @@ -205,8 +183,7 @@ public interface FileSystemManager FileObject createVirtualFileSystem(FileObject rootFile) throws FileSystemException; /** - * Returns a stream handler factory to enable URL lookup using this - * FileSystemManager. + * Returns a stream handler factory to enable URL lookup using this FileSystemManager. * * @return the URLStreamHandlerFactory. */ @@ -243,8 +220,7 @@ public interface FileSystemManager Class<?> getFileObjectDecorator(); /** - * The constructor associated to the fileObjectDecorator. - * We cache it here for performance reasons. + * The constructor associated to the fileObjectDecorator. We cache it here for performance reasons. * * @return the Constructor associated with the FileObjectDecorator. */ @@ -310,16 +286,14 @@ public interface FileSystemManager /** * Adds the specified FileOperationProvider for the specified scheme. * <p> - * Several FileOperationProvider's might be registered for the same scheme. - * For example, for {@code "file"} scheme we can register {@code SvnWsOperationProvider} and - * {@code CvsOperationProvider.} + * Several FileOperationProvider's might be registered for the same scheme. For example, for {@code "file"} scheme + * we can register {@code SvnWsOperationProvider} and {@code CvsOperationProvider.} * * @param scheme The scheme assoicated with this provider. * @param operationProvider The FileOperationProvider to add. * @throws FileSystemException if an error occurs. */ - void addOperationProvider(String scheme, FileOperationProvider operationProvider) - throws FileSystemException; + void addOperationProvider(String scheme, FileOperationProvider operationProvider) throws FileSystemException; /** * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs2.operations.FileOperationProvider) @@ -328,17 +302,15 @@ public interface FileSystemManager * @param operationProvider The FileOperationProvider to add. * @throws FileSystemException if an error occurs. */ - void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) - throws FileSystemException; - + void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) throws FileSystemException; /** * Get Providers for file operations. * * @param scheme the scheme for wich we want to get the list af registered providers. * - * @return the registered FileOperationProviders for the specified scheme. - * If there were no providers registered for the scheme, it returns null. + * @return the registered FileOperationProviders for the specified scheme. If there were no providers registered for + * the scheme, it returns null. * * @throws FileSystemException if an error occurs. */ @@ -348,8 +320,7 @@ public interface FileSystemManager * Resolves a URI into a {@link FileObject}. * * @param uri The URI to convert. - * @return The {@link FileObject} that represents the URI. Never - * returns null. + * @return The {@link FileObject} that represents the URI. Never returns null. * @throws FileSystemException On error converting the file. * @since 2.1 */ @@ -359,8 +330,7 @@ public interface FileSystemManager * Resolves a URL into a {@link FileObject}. * * @param url The URL to convert. - * @return The {@link FileObject} that represents the URL. Never - * returns null. + * @return The {@link FileObject} that represents the URL. Never returns null. * @throws FileSystemException On error converting the file. * @since 2.1 */ Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java Thu Sep 14 19:26:39 2017 @@ -42,29 +42,25 @@ import java.util.TreeMap; * @see org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder * */ -public final class FileSystemOptions implements Cloneable -{ +public final class FileSystemOptions implements Cloneable { /** The options */ private final Map<FileSystemOptionKey, Object> options; /** * Creates a new instance. */ - public FileSystemOptions() - { + public FileSystemOptions() { this(new TreeMap<FileSystemOptionKey, Object>()); } - protected FileSystemOptions(final Map<FileSystemOptionKey, Object> options) - { + protected FileSystemOptions(final Map<FileSystemOptionKey, Object> options) { this.options = options; } /** * Keys in the options Map. */ - private static final class FileSystemOptionKey implements Comparable<FileSystemOptionKey> - { + private static final class FileSystemOptionKey implements Comparable<FileSystemOptionKey> { /** Constant used to create hashcode */ private static final int HASH = 29; @@ -76,43 +72,35 @@ public final class FileSystemOptions imp // TODO: the parameter name suggests that the class should only be a // a FileSystem, however some of the tests pass in DefaultFileSystemConfigBuilder - private FileSystemOptionKey(final Class<? extends FileSystem> fileSystemClass, final String name) - { + private FileSystemOptionKey(final Class<? extends FileSystem> fileSystemClass, final String name) { this.fileSystemClass = fileSystemClass; this.name = name; } @Override - public int compareTo(final FileSystemOptionKey o) - { + public int compareTo(final FileSystemOptionKey o) { final int ret = fileSystemClass.getName().compareTo(o.fileSystemClass.getName()); - if (ret != 0) - { + if (ret != 0) { return ret; } return name.compareTo(o.name); } @Override - public boolean equals(final Object o) - { - if (this == o) - { + public boolean equals(final Object o) { + if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) - { + if (o == null || getClass() != o.getClass()) { return false; } final FileSystemOptionKey that = (FileSystemOptionKey) o; - if (!fileSystemClass.equals(that.fileSystemClass)) - { + if (!fileSystemClass.equals(that.fileSystemClass)) { return false; } - if (!name.equals(that.name)) - { + if (!name.equals(that.name)) { return false; } @@ -120,8 +108,7 @@ public final class FileSystemOptions imp } @Override - public int hashCode() - { + public int hashCode() { int result; result = fileSystemClass.hashCode(); result = HASH * result + name.hashCode(); @@ -129,65 +116,54 @@ public final class FileSystemOptions imp } @Override - public String toString() - { - return fileSystemClass.getName()+"."+name; + public String toString() { + return fileSystemClass.getName() + "." + name; } } - void setOption(final Class<? extends FileSystem> fileSystemClass, final String name, final Object value) - { + void setOption(final Class<? extends FileSystem> fileSystemClass, final String name, final Object value) { options.put(new FileSystemOptionKey(fileSystemClass, name), value); } - Object getOption(final Class<? extends FileSystem> fileSystemClass, final String name) - { + Object getOption(final Class<? extends FileSystem> fileSystemClass, final String name) { final FileSystemOptionKey key = new FileSystemOptionKey(fileSystemClass, name); return options.get(key); } - boolean hasOption(final Class<? extends FileSystem> fileSystemClass, final String name) - { + boolean hasOption(final Class<? extends FileSystem> fileSystemClass, final String name) { final FileSystemOptionKey key = new FileSystemOptionKey(fileSystemClass, name); return options.containsKey(key); } - public int compareTo(final FileSystemOptions other) - { - if (this == other) - { + public int compareTo(final FileSystemOptions other) { + if (this == other) { // the same instance return 0; } final int propsSz = options == null ? 0 : options.size(); final int propsFkSz = other.options == null ? 0 : other.options.size(); - if (propsSz < propsFkSz) - { + if (propsSz < propsFkSz) { return -1; } - if (propsSz > propsFkSz) - { + if (propsSz > propsFkSz) { return 1; } - if (propsSz == 0) - { + if (propsSz == 0) { // props empty return 0; } // ensure proper sequence of options - final SortedMap<FileSystemOptionKey, Object> myOptions = - options instanceof SortedMap - ? (SortedMap<FileSystemOptionKey, Object>)options - : new TreeMap<>(options); - final SortedMap<FileSystemOptionKey, Object> theirOptions = - other.options instanceof SortedMap - ? (SortedMap<FileSystemOptionKey, Object>)other.options - : new TreeMap<>(other.options); + final SortedMap<FileSystemOptionKey, Object> myOptions = options instanceof SortedMap + ? (SortedMap<FileSystemOptionKey, Object>) options + : new TreeMap<>(options); + final SortedMap<FileSystemOptionKey, Object> theirOptions = other.options instanceof SortedMap + ? (SortedMap<FileSystemOptionKey, Object>) other.options + : new TreeMap<>(other.options); final Iterator<FileSystemOptionKey> optKeysIter = myOptions.keySet().iterator(); final Iterator<FileSystemOptionKey> otherKeysIter = theirOptions.keySet().iterator(); - while(optKeysIter.hasNext()) { + while (optKeysIter.hasNext()) { final int comp = optKeysIter.next().compareTo(otherKeysIter.next()); if (comp != 0) { return comp; @@ -197,12 +173,10 @@ public final class FileSystemOptions imp final Object[] array = new Object[propsSz]; final int hash = Arrays.deepHashCode(myOptions.values().toArray(array)); final int hashFk = Arrays.deepHashCode(theirOptions.values().toArray(array)); - if (hash < hashFk) - { + if (hash < hashFk) { return -1; } - if (hash > hashFk) - { + if (hash > hashFk) { return 1; } @@ -211,17 +185,15 @@ public final class FileSystemOptions imp } @Override - public int hashCode() - { + public int hashCode() { final int prime = 31; int result = 1; if (options == null) { result = prime * result; } else { - final SortedMap<FileSystemOptionKey, Object> myOptions = - options instanceof SortedMap - ? (SortedMap<FileSystemOptionKey, Object>)options - : new TreeMap<>(options); + final SortedMap<FileSystemOptionKey, Object> myOptions = options instanceof SortedMap + ? (SortedMap<FileSystemOptionKey, Object>) options + : new TreeMap<>(options); result = prime * result + myOptions.keySet().hashCode(); result = prime * result + Arrays.deepHashCode(myOptions.values().toArray(new Object[options.size()])); } @@ -229,8 +201,7 @@ public final class FileSystemOptions imp } @Override - public boolean equals(final Object obj) - { + public boolean equals(final Object obj) { if (this == obj) { return true; } @@ -240,25 +211,22 @@ public final class FileSystemOptions imp if (getClass() != obj.getClass()) { return false; } - final FileSystemOptions other = (FileSystemOptions)obj; + final FileSystemOptions other = (FileSystemOptions) obj; return compareTo(other) == 0; } - /** * {@inheritDoc} * * @since 2.0 */ @Override - public Object clone() - { + public Object clone() { return new FileSystemOptions(new TreeMap<>(options)); } @Override - public String toString() - { + public String toString() { return options.toString(); } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java Thu Sep 14 19:26:39 2017 @@ -19,29 +19,24 @@ package org.apache.commons.vfs2; /** * An enumerated type that represents a file's type. */ -public enum FileType -{ +public enum FileType { /** - * A folder. May contain other files, and have attributes, but does not - * have any data content. + * A folder. May contain other files, and have attributes, but does not have any data content. */ FOLDER("folder", true, false, true), /** - * A regular file. May have data content and attributes, but cannot - * contain other files. + * A regular file. May have data content and attributes, but cannot contain other files. */ FILE("file", false, true, true), /** - * A file or folder. May have data content and attributes, and can - * contain other files. + * A file or folder. May have data content and attributes, and can contain other files. */ FILE_OR_FOLDER("fileOrFolder", true, true, true), /** - * A file that does not exist. May not have data content, attributes, - * or contain other files. + * A file that does not exist. May not have data content, attributes, or contain other files. */ IMAGINARY("imaginary", false, false, false); @@ -57,11 +52,7 @@ public enum FileType /** true if the FileType has attributes */ private final boolean hasAttrs; - private FileType(final String name, - final boolean hasChildren, - final boolean hasContent, - final boolean hasAttrs) - { + private FileType(final String name, final boolean hasChildren, final boolean hasContent, final boolean hasAttrs) { this.name = name; this.hasChildren = hasChildren; this.hasContent = hasContent; @@ -70,47 +61,47 @@ public enum FileType /** * Returns the name of this type. + * * @return The name of this type. */ @Override - public String toString() - { + public String toString() { return name; } /** * Returns the name of this type. + * * @return The name of the type. */ - public String getName() - { + public String getName() { return name; } /** * Returns true if files of this type may contain other files. + * * @return true if files can contain other files. */ - public boolean hasChildren() - { + public boolean hasChildren() { return hasChildren; } /** * Returns true if files of this type may have data content. + * * @return true if files can have content. */ - public boolean hasContent() - { + public boolean hasContent() { return hasContent; } /** * Returns true if files of this type may have attributes. + * * @return true if files can have attributes */ - public boolean hasAttributes() - { + public boolean hasAttributes() { return hasAttrs; } } Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java?rev=1808381&r1=1808380&r2=1808381&view=diff ============================================================================== --- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java (original) +++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java Thu Sep 14 19:26:39 2017 @@ -19,22 +19,20 @@ package org.apache.commons.vfs2; /** * delivers a file-not-folder exception which happens when trying to issue * {@link org.apache.commons.vfs2.FileObject#getChildren()} on a file. + * * @since 2.0 */ -public class FileTypeHasNoContentException extends FileSystemException -{ +public class FileTypeHasNoContentException extends FileSystemException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ private static final long serialVersionUID = 20101208L; - public FileTypeHasNoContentException(final Object info0) - { + public FileTypeHasNoContentException(final Object info0) { super("vfs.provider/read-not-file.error", info0); } - public FileTypeHasNoContentException(final Object info0, final Throwable throwable) - { + public FileTypeHasNoContentException(final Object info0, final Throwable throwable) { super("vfs.provider/read-not-file.error", info0, throwable); } }
