This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push: new b204ca7 Sort methods. b204ca7 is described below commit b204ca7e59c1d2d481d77bbf5e1463a82427ba9f Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Fri May 10 10:34:42 2019 -0400 Sort methods. --- .../java/org/apache/commons/vfs2/FileContent.java | 186 ++++++++++----------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java index 0500d22..6226b95 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java @@ -42,54 +42,25 @@ import org.apache.commons.vfs2.util.RandomAccessMode; */ public interface FileContent extends Closeable { /** - * Returns the file which this is the content of. - * - * @return The FileObject this is the content of. - */ - FileObject getFile(); - - /** - * Determines the size of the file, in bytes. - * - * @return The size of the file, in bytes. - * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the size. - */ - long getSize() throws FileSystemException; - - /** - * Determines the last-modified timestamp of the file. - * - * @return The last-modified timestamp. - * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the - * last-modified timestamp. - */ - long getLastModifiedTime() throws FileSystemException; - - /** - * Sets the last-modified timestamp of the file. Creates the file if it does not exist. - * - * @param modTime The time to set the last-modified timestamp to. - * @throws FileSystemException If the file is read-only, or is being written to, or on error setting the - * last-modified timestamp. - */ - void setLastModifiedTime(long modTime) throws FileSystemException; - - /** - * Checks if an attribute of the file's content exists. + * Closes all resources used by the content, including any open stream. Commits pending changes to the file. + * <p> + * This method is a hint to the implementation that it can release resources. This object can continue to be used + * after calling this method. + * </p> * - * @param attrName The name of the attribute. - * @return true if the attribute exists, false otherwise. - * @throws FileSystemException If the file does not exist, or does not support attributes. + * @throws FileSystemException if an error occurs closing the file. */ - boolean hasAttribute(String attrName) throws FileSystemException; + @Override + void close() throws FileSystemException; /** - * Returns a read-only map of this file's attributes. + * Gets the value of an attribute of the file's content. * - * @return The attribute Map. + * @param attrName The name of the attribute. Attribute names are case insensitive. + * @return The value of the attribute, or null if the attribute value is unknown. * @throws FileSystemException If the file does not exist, or does not support attributes. */ - Map<String, Object> getAttributes() throws FileSystemException; + Object getAttribute(String attrName) throws FileSystemException; /** * Lists the attributes of the file's content. @@ -100,40 +71,35 @@ public interface FileContent extends Closeable { String[] getAttributeNames() throws FileSystemException; /** - * Gets the value of an attribute of the file's content. + * Returns a read-only map of this file's attributes. * - * @param attrName The name of the attribute. Attribute names are case insensitive. - * @return The value of the attribute, or null if the attribute value is unknown. + * @return The attribute Map. * @throws FileSystemException If the file does not exist, or does not support attributes. */ - Object getAttribute(String attrName) throws FileSystemException; + Map<String, Object> getAttributes() throws FileSystemException; /** - * Sets the value of an attribute of the file's content. Creates the file if it does not exist. + * Retrieves the certificates if any used to sign this file or folder. * - * @param attrName The name of the attribute. - * @param value The value of the attribute. - * @throws FileSystemException If the file does not exist, or is read-only, or does not support attributes, or on - * error setting the attribute. + * @return The certificates, or an empty array if there are no certificates or the file does not support signing. + * @throws FileSystemException If the file does not exist, or is being written. */ - void setAttribute(String attrName, Object value) throws FileSystemException; + Certificate[] getCertificates() throws FileSystemException; /** - * Removes the value of an attribute of the file's content. + * get the content info. e.g. type, encoding, ... * - * @param attrName The name of the attribute. - * @throws FileSystemException If the file does not exist, or is read-only, or does not support attributes, or on - * error removing the attribute. + * @return the FileContentInfo + * @throws FileSystemException if an error occurs. */ - void removeAttribute(String attrName) throws FileSystemException; + FileContentInfo getContentInfo() throws FileSystemException; /** - * Retrieves the certificates if any used to sign this file or folder. + * Returns the file which this is the content of. * - * @return The certificates, or an empty array if there are no certificates or the file does not support signing. - * @throws FileSystemException If the file does not exist, or is being written. + * @return The FileObject this is the content of. */ - Certificate[] getCertificates() throws FileSystemException; + FileObject getFile(); /** * Returns an input stream for reading the file's content. @@ -166,6 +132,15 @@ public interface FileContent extends Closeable { } /** + * Determines the last-modified timestamp of the file. + * + * @return The last-modified timestamp. + * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the + * last-modified timestamp. + */ + long getLastModifiedTime() throws FileSystemException; + + /** * Returns an output stream for writing the file's content. * <p> * If the file does not exist, this method creates it, and the parent folder, if necessary. If the file does exist, @@ -183,24 +158,6 @@ public interface FileContent extends Closeable { OutputStream getOutputStream() throws FileSystemException; /** - * Returns an stream for reading/writing the file's content. - * <p> - * If the file does not exist, and you use one of the write* methods, this method creates it, and the parent folder, - * if necessary. If the file does exist, parts of the file are replaced with whatever is written at a given - * position. - * </p> - * <p> - * There may only be a single input or output stream open for the file at any time. - * </p> - * - * @param mode The mode to use to access the file. - * @return the stream for reading and writing the file's content. - * @throws FileSystemException If the file is read-only, or is being read, or is being written, or on error opening - * the stream. - */ - RandomAccessContent getRandomAccessContent(final RandomAccessMode mode) throws FileSystemException; - - /** * Returns an output stream for writing the file's content. * <p> * If the file does not exist, this method creates it, and the parent folder, if necessary. If the file does exist, @@ -228,6 +185,7 @@ public interface FileContent extends Closeable { * There may only be a single input or output stream open for the file at any time. * </p> * + * @param bAppend true if you would like to append to the file. This may not be supported by all implementations. * @param bufferSize The buffer size to use. * @return An output stream to write the file's content to. The stream is buffered, so there is no need to wrap it * in a {@code BufferedOutputStream}. @@ -235,8 +193,8 @@ public interface FileContent extends Closeable { * and the implementation does not support it, or on error opening the stream. * @since 2.4 */ - default OutputStream getOutputStream(int bufferSize) throws FileSystemException { - return getOutputStream(); + default OutputStream getOutputStream(boolean bAppend, int bufferSize) throws FileSystemException { + return getOutputStream(bAppend); } /** @@ -249,7 +207,6 @@ public interface FileContent extends Closeable { * There may only be a single input or output stream open for the file at any time. * </p> * - * @param bAppend true if you would like to append to the file. This may not be supported by all implementations. * @param bufferSize The buffer size to use. * @return An output stream to write the file's content to. The stream is buffered, so there is no need to wrap it * in a {@code BufferedOutputStream}. @@ -257,29 +214,44 @@ public interface FileContent extends Closeable { * and the implementation does not support it, or on error opening the stream. * @since 2.4 */ - default OutputStream getOutputStream(boolean bAppend, int bufferSize) throws FileSystemException { - return getOutputStream(bAppend); + default OutputStream getOutputStream(int bufferSize) throws FileSystemException { + return getOutputStream(); } /** - * Closes all resources used by the content, including any open stream. Commits pending changes to the file. + * Returns an stream for reading/writing the file's content. * <p> - * This method is a hint to the implementation that it can release resources. This object can continue to be used - * after calling this method. + * If the file does not exist, and you use one of the write* methods, this method creates it, and the parent folder, + * if necessary. If the file does exist, parts of the file are replaced with whatever is written at a given + * position. + * </p> + * <p> + * There may only be a single input or output stream open for the file at any time. * </p> * - * @throws FileSystemException if an error occurs closing the file. + * @param mode The mode to use to access the file. + * @return the stream for reading and writing the file's content. + * @throws FileSystemException If the file is read-only, or is being read, or is being written, or on error opening + * the stream. */ - @Override - void close() throws FileSystemException; + RandomAccessContent getRandomAccessContent(final RandomAccessMode mode) throws FileSystemException; /** - * get the content info. e.g. type, encoding, ... + * Determines the size of the file, in bytes. * - * @return the FileContentInfo - * @throws FileSystemException if an error occurs. + * @return The size of the file, in bytes. + * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the size. */ - FileContentInfo getContentInfo() throws FileSystemException; + long getSize() throws FileSystemException; + + /** + * Checks if an attribute of the file's content exists. + * + * @param attrName The name of the attribute. + * @return true if the attribute exists, false otherwise. + * @throws FileSystemException If the file does not exist, or does not support attributes. + */ + boolean hasAttribute(String attrName) throws FileSystemException; /** * check if this file has open streams. @@ -289,6 +261,34 @@ public interface FileContent extends Closeable { boolean isOpen(); /** + * Removes the value of an attribute of the file's content. + * + * @param attrName The name of the attribute. + * @throws FileSystemException If the file does not exist, or is read-only, or does not support attributes, or on + * error removing the attribute. + */ + void removeAttribute(String attrName) throws FileSystemException; + + /** + * 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 does not exist, or is read-only, or does not support attributes, or on + * error setting the attribute. + */ + void setAttribute(String attrName, Object value) throws FileSystemException; + + /** + * Sets the last-modified timestamp of the file. Creates the file if it does not exist. + * + * @param modTime The time to set the last-modified timestamp to. + * @throws FileSystemException If the file is read-only, or is being written to, or on error setting the + * last-modified timestamp. + */ + void setLastModifiedTime(long modTime) throws FileSystemException; + + /** * Writes this content to another FileContent. * * @param output The target OutputStream.