From 243ed5b08cf8c10abc259643b8e84348dd23f4bd Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 12 Aug 2024 07:11:46 -0400 Subject: [PATCH] Javadoc --- .../commons/vfs2/provider/smb/SmbFileName.java | 13 +++++++++++++ .../commons/vfs2/provider/GenericFileName.java | 12 ++++++++++++ .../commons/vfs2/provider/local/LocalFileName.java | 8 ++++++++ .../vfs2/provider/local/WindowsFileName.java | 8 ++++++++ .../commons/vfs2/provider/res/ResourceFileName.java | 7 +++++++ .../commons/vfs2/provider/tar/TarFileSystem.java | 12 +++++++++++- .../commons/vfs2/provider/url/UrlFileObject.java | 12 +++++++++--- .../commons/vfs2/provider/url/UrlFileSystem.java | 6 ++++++ .../commons/vfs2/util/WeakRefFileListener.java | 6 ++++++ 9 files changed, 80 insertions(+), 4 deletions(-) diff --git a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java index 38ceee9d7b..eb7a4582dc 100644 --- a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java @@ -31,6 +31,19 @@ public class SmbFileName extends GenericFileName { private final String domain; private String uriWithoutAuth; + /** + * Constructs a new instance. + * + * @param scheme the scheme. + * @param hostName the host name. + * @param port the port. + * @param userName the user name. + * @param password the password. + * @param domain the domain. + * @param share the share. + * @param path the absolute path, maybe empty or null. + * @param type the file type. + */ protected SmbFileName(final String scheme, final String hostName, final int port, final String userName, final String password, final String domain, final String share, final String path, final FileType type) { super(scheme, hostName, port, DEFAULT_PORT, userName, password, path, type); diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java index 12a5ebe65a..5321e1df2b 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/GenericFileName.java @@ -32,6 +32,18 @@ public class GenericFileName extends AbstractFileName { private final String password; private final int port; + /** + * Constructs a new instance. + * + * @param scheme the scheme. + * @param hostName the host name. + * @param port the port. + * @param defaultPort the default port. + * @param userName the user name. + * @param password the password. + * @param path the absolute path, maybe empty or null. + * @param type the file type. + */ protected GenericFileName(final String scheme, final String hostName, final int port, final int defaultPort, final String userName, final String password, final String path, final FileType type) { super(scheme, path, type); diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java index ff86c025a9..d85b9e905d 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFileName.java @@ -29,6 +29,14 @@ public class LocalFileName extends AbstractFileName { private final String rootFile; + /** + * Constructs a new instance. + * + * @param scheme the scheme. + * @param rootFile the root file. + * @param path the absolute path, maybe empty or null. + * @param type the file type. + */ protected LocalFileName(final String scheme, final String rootFile, final String path, final FileType type) { super(scheme, path, type); this.rootFile = rootFile; diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java index e56f4ab219..663257a2d9 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/WindowsFileName.java @@ -24,6 +24,14 @@ */ public class WindowsFileName extends LocalFileName { + /** + * Constructs a new instance. + * + * @param scheme the scheme. + * @param rootFile the root file. + * @param path the absolute path, maybe empty or null. + * @param type the file type. + */ protected WindowsFileName(final String scheme, final String rootFile, final String path, final FileType type) { super(scheme, rootFile, path, type); } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java index 80b982fca7..495d3e791a 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/res/ResourceFileName.java @@ -27,6 +27,13 @@ */ public class ResourceFileName extends AbstractFileName { + /** + * Constructs a new instance. + * + * @param scheme The scheme. + * @param path the absolute path, maybe empty or null. + * @param type the file type. + */ protected ResourceFileName(final String scheme, final String path, final FileType type) { super(scheme, path, type); } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java index 0feb553048..554fa98260 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/tar/TarFileSystem.java @@ -158,6 +158,12 @@ public InputStream getInputStream(final TarArchiveEntry entry) throws FileSystem } } + /** + * Gets the TarArchiveInputStream. + * + * @return the TarArchiveInputStream. + * @throws FileSystemException if a file system error occurs. + */ protected TarArchiveInputStream getTarFile() throws FileSystemException { if (tarFile == null && file.exists()) { recreateTarFile(); @@ -223,7 +229,6 @@ protected void putFileToCache(final FileObject file) { * will be called after all file-objects closed their streams. protected void notifyAllStreamsClosed() { * closeCommunicationLink(); } */ - private void recreateTarFile() throws FileSystemException { if (tarFile != null) { try { @@ -244,6 +249,11 @@ protected void removeFileFromCache(final FileName name) { cache.remove(name); } + /** + * Resets the tar file. + * + * @throws FileSystemException if a file system error occurs. + */ protected void resetTarFile() throws FileSystemException { // Reading specific entries requires skipping through the tar file from the beginning // Not especially elegant, but we don't have the ability to seek to specific positions diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java index fe57153923..13ef8f0f4f 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileObject.java @@ -17,13 +17,12 @@ package org.apache.commons.vfs2.provider.url; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import org.apache.commons.httpclient.URIException; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType; @@ -53,7 +52,14 @@ protected UrlFileObject(final UrlFileSystem fileSystem, final AbstractFileName f super(fileName, fileSystem); } - protected URL createURL(final FileName name) throws MalformedURLException, FileSystemException, URIException { + /** + * Creates a URL from the given file name. + * + * @param name the file name. + * @return a new URL. + * @throws IOException if an I/O error occurs. + */ + protected URL createURL(final FileName name) throws IOException { if (name instanceof URLFileName) { final URLFileName urlName = (URLFileName) getName(); diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java index 2f26693a3d..ea66221491 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/url/UrlFileSystem.java @@ -30,6 +30,12 @@ */ public class UrlFileSystem extends AbstractFileSystem { + /** + * Constructs a new instance. + * + * @param rootName The root file name of this file system. + * @param fileSystemOptions Options to build this file system. + */ protected UrlFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java index 09c71d51ee..ba9cf2cbce 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/WeakRefFileListener.java @@ -57,6 +57,12 @@ public static void installListener(final FileObject file, final FileListener lis private final WeakReference listener; + /** + * Constructs a new instance. + * + * @param file the file object. + * @param listener the file listener. + */ protected WeakRefFileListener(final FileObject file, final FileListener listener) { fs = file.getFileSystem(); name = file.getName();