Repository: tomee
Updated Branches:
  refs/heads/master df8d80edc -> 0866dbe45


added JavaDoc and use of diamond operator


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/298cdee7
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/298cdee7
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/298cdee7

Branch: refs/heads/master
Commit: 298cdee7d52c9d048264d5e82558988e966413fe
Parents: 42605b7
Author: Hayri Cicek <ha...@kodnito.com>
Authored: Fri Dec 7 21:38:07 2018 +0100
Committer: Hayri Cicek <ha...@kodnito.com>
Committed: Fri Dec 7 21:38:07 2018 +0100

----------------------------------------------------------------------
 .../openejb/loader/BasicURLClassPath.java       |  12 ++
 .../apache/openejb/loader/ContextClassPath.java |  14 ++
 .../org/apache/openejb/loader/Embedder.java     |   2 +-
 .../org/apache/openejb/loader/FileUtils.java    |  55 +++++-
 .../java/org/apache/openejb/loader/Files.java   | 163 +++++++++++++++-
 .../main/java/org/apache/openejb/loader/IO.java | 191 ++++++++++++++++++-
 6 files changed, 421 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/BasicURLClassPath.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/BasicURLClassPath.java
 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/BasicURLClassPath.java
index e8acf96..c78f223 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/BasicURLClassPath.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/BasicURLClassPath.java
@@ -67,6 +67,12 @@ public abstract class BasicURLClassPath implements ClassPath 
{
         });
     }
 
+    /**
+     *
+     * @param dir
+     * @param loader
+     * @throws Exception
+     */
     protected synchronized void addJarsToPath(final File dir, final 
URLClassLoader loader) throws Exception {
         if (dir == null || !dir.exists()) {
             return;
@@ -111,6 +117,12 @@ public abstract class BasicURLClassPath implements 
ClassPath {
         }
     }
 
+    /**
+     *
+     * @param loader
+     * @return Object
+     * @throws Exception
+     */
     protected Object getURLClassPath(final URLClassLoader loader) throws 
Exception {
         final Field ucpField = this.getUcpField();
         if (ucpField == null) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/ContextClassPath.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ContextClassPath.java
 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ContextClassPath.java
index 71c4aa2..68cfdae 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/ContextClassPath.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/ContextClassPath.java
@@ -26,11 +26,20 @@ import java.net.URLClassLoader;
 
 public class ContextClassPath extends BasicURLClassPath {
 
+    /**
+     *
+     * @return the context ClassLoader for this Thread or null
+     */
     @Override
     public ClassLoader getClassLoader() {
         return getContextClassLoader();
     }
 
+    /**
+     *
+     * @param dir
+     * @throws Exception
+     */
     @Override
     public void addJarsToPath(final File dir) throws Exception {
         final ClassLoader contextClassLoader = getContextClassLoader();
@@ -40,6 +49,11 @@ public class ContextClassPath extends BasicURLClassPath {
         }
     }
 
+    /**
+     *
+     * @param jar
+     * @throws Exception
+     */
     @Override
     public void addJarToPath(final URL jar) throws Exception {
         final ClassLoader contextClassLoader = getContextClassLoader();

http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/Embedder.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Embedder.java
 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Embedder.java
index a9554a3..2cf2329 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Embedder.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Embedder.java
@@ -80,7 +80,7 @@ public class Embedder {
             final Object value = init.invoke(instance, properties);
             return value;
         } catch (final NoSuchMethodException e) {
-            throw (IllegalStateException) new 
IllegalStateException("Signatures for Loader are no longer 
correct.").initCause(e);
+            throw new IllegalStateException("Signatures for Loader are no 
longer correct.", e);
         } catch (final InvocationTargetException e) {
             final Throwable cause = e.getCause();
             if (cause instanceof Error) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
index 8437ff4..e710136 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
@@ -24,7 +24,7 @@ import java.util.Hashtable;
 @SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
 public class FileUtils {
 
-    private static final java.util.Random _random = new java.util.Random();
+    private static final java.util.Random RANDOM = new java.util.Random();
 
     private File home;
 
@@ -32,6 +32,12 @@ public class FileUtils {
         this(homeDir, defaultDir, SystemInstance.get().getProperties());
     }
 
+    /**
+     *
+     * @param homeDir
+     * @param defaultDir
+     * @param env
+     */
     @SuppressWarnings("UseOfObsoleteCollectionType")
     public FileUtils(final String homeDir, final String defaultDir, final 
Hashtable env) {
 
@@ -59,6 +65,12 @@ public class FileUtils {
         }
     }
 
+    /**
+     *
+     * @param path
+     * @return File
+     * @throws IOException
+     */
     public File getDirectory(final String path) throws IOException {
         return getDirectory(path, false);
     }
@@ -72,6 +84,13 @@ public class FileUtils {
         return this.getDirectory().equals(that.getDirectory());
     }
 
+    /**
+     *
+     * @param path
+     * @param create
+     * @return File
+     * @throws IOException
+     */
     public File getDirectory(final String path, final boolean create) throws 
IOException {
         File dir = new File(home, path);
         dir = dir.getCanonicalFile();
@@ -92,18 +111,39 @@ public class FileUtils {
         return dir;
     }
 
+    /**
+     *
+     * @return File
+     */
     public File getDirectory() {
         return home;
     }
 
+    /**
+     *
+     * @param dir
+     */
     public void setDirectory(final File dir) {
         this.home = dir;
     }
 
+    /**
+     *
+     * @param path
+     * @return File
+     * @throws IOException
+     */
     public File getFile(final String path) throws IOException {
         return getFile(path, true);
     }
 
+    /**
+     *
+     * @param path
+     * @param validate
+     * @return File
+     * @throws IOException
+     */
     public File getFile(final String path, final boolean validate) throws 
IOException {
         File file = new File(path);
 
@@ -120,10 +160,16 @@ public class FileUtils {
         return file;
     }
 
+    /**
+     *
+     * @param pathPrefix
+     * @return File
+     * @throws IOException
+     */
     public static File createTempDirectory(final String pathPrefix) throws 
IOException {
         for (int maxAttempts = 100; maxAttempts > 0; --maxAttempts) {
 
-            final String path = pathPrefix + _random.nextLong();
+            final String path = pathPrefix + RANDOM.nextLong();
             final File tmpDir = new File(path);
 
             if (!tmpDir.exists() && tmpDir.mkdirs()) {
@@ -133,6 +179,11 @@ public class FileUtils {
         throw new IOException("Cannot create temporary directory at: " + 
pathPrefix);
     }
 
+    /**
+     *
+     * @return File
+     * @throws IOException
+     */
     public static File createTempDirectory() throws IOException {
         final String prefix = System.getProperty("java.io.tmpdir", 
File.separator + "tmp") + File.separator + "openejb";
         return createTempDirectory(prefix);

http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/Files.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Files.java 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Files.java
index 9a2dc5b..e622851 100644
--- 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/Files.java
+++ 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/Files.java
@@ -46,6 +46,11 @@ public class Files {
     private static final Map<String, MessageDigest> DIGESTS = new 
HashMap<String, MessageDigest>();
     private static final boolean IS_WINDOWS = System.getProperty("os.name", 
"unknown").toLowerCase(Locale.ENGLISH).startsWith("win");
 
+    /**
+     *
+     * @param parts String...
+     * @return File
+     */
     public static File path(final String... parts) {
         File dir = null;
         for (final String part : parts) {
@@ -59,6 +64,12 @@ public class Files {
         return null != dir ? dir.getAbsoluteFile() : dir;
     }
 
+    /**
+     *
+     * @param dir File
+     * @param parts String...
+     * @return File
+     */
     public static File path(final File dir, final String... parts) {
         File base = dir;
         int idx = 0;
@@ -77,17 +88,34 @@ public class Files {
         return base.getAbsoluteFile();
     }
 
+    /**
+     *
+     * @param dir File
+     * @param regex String
+     * @return List of Files
+     */
     public static List<File> collect(final File dir, final String regex) {
         return collect(dir, Pattern.compile(regex));
     }
 
+    /**
+     *
+     * @param dir File
+     * @param pattern Pattern
+     * @return List of Files
+     */
     public static List<File> collect(final File dir, final Pattern pattern) {
         return collect(dir, new PatternFileFilter(pattern));
     }
 
-
+    /**
+     *
+     * @param dir File
+     * @param filter FileFilter
+     * @return List of Files
+     */
     public static List<File> collect(final File dir, final FileFilter filter) {
-        final List<File> accepted = new ArrayList<File>();
+        final List<File> accepted = new ArrayList<>();
         if (filter.accept(dir)) {
             accepted.add(dir);
         }
@@ -102,6 +130,13 @@ public class Files {
         return accepted;
     }
 
+    /**
+     *
+     * @param file File
+     * @param s String
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File exists(final File file, final String s) {
         if (!file.exists()) {
             throw new FileDoesNotExistException(s + " does not exist: " + 
file.getAbsolutePath());
@@ -109,6 +144,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File exists(final File file) {
         if (!file.exists()) {
             throw new FileDoesNotExistException("Does not exist: " + 
file.getAbsolutePath());
@@ -116,6 +157,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File dir(final File file) {
         if (!file.isDirectory()) {
             throw new FileRuntimeException("Not a directory: " + 
file.getAbsolutePath());
@@ -124,6 +171,13 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @throws IOException
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File touch(final File file) throws IOException {
         if (!file.createNewFile()) {
             throw new FileRuntimeException("Cannot create file: " + 
file.getAbsolutePath());
@@ -131,6 +185,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File file(final File file) {
         exists(file);
         if (!file.isFile()) {
@@ -139,6 +199,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File notHidden(final File file) {
         exists(file);
         if (file.isHidden()) {
@@ -147,6 +213,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File writable(final File file) {
         if (!file.canWrite()) {
             throw new FileRuntimeException("Not writable: " + 
file.getAbsolutePath());
@@ -154,6 +226,12 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File readable(final File file) {
         if (!file.canRead()) {
             throw new FileRuntimeException("Not readable: " + 
file.getAbsolutePath());
@@ -161,10 +239,21 @@ public class Files {
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     */
     public static File readableFile(final File file) {
         return readable(file(file));
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File mkdir(final File file) {
         if (file.exists()) {
             return file;
@@ -185,10 +274,21 @@ public class Files {
         }
     }
 
+    /**
+     *
+     * @param file file
+     * @param name String
+     * @return File
+     */
     public static File mkdir(final File file, final String name) {
         return mkdir(new File(file, name));
     }
 
+    /**
+     *
+     * @return File
+     * @Throws IOException on failure at any point
+     */
     public static File tmpdir() {
         try {
             File file;
@@ -223,11 +323,22 @@ public class Files {
         }
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     */
     public static File mkparent(final File file) {
         mkdirs(file.getParentFile());
         return file;
     }
 
+    /**
+     *
+     * @param file File
+     * @return File
+     * @Throws FileRuntimeException on failure at any point
+     */
     public static File mkdirs(final File file) {
 
         if (!file.exists()) {
@@ -245,8 +356,8 @@ public class Files {
     }
 
 
-    // Shutdown hook for recursive delete on tmp directories
-    static final List<String> delete = new ArrayList<String>();
+    // Shutdown hook for recursive DELETE on tmp directories
+    static final List<String> DELETE = new ArrayList<String>();
 
     static {
         final ClassLoader loader = 
Thread.currentThread().getContextClassLoader();
@@ -263,11 +374,19 @@ public class Files {
         }
     }
 
+    /**
+     *
+     * @param file File
+     */
     public static void deleteOnExit(final File file) {
-        delete.add(file.getAbsolutePath());
+        DELETE.add(file.getAbsolutePath());
         flagForDeleteOnExit(file);
     }
 
+    /**
+     *
+     * @param file File
+     */
     public static void flagForDeleteOnExit(final File file) {
         if (file.exists()) {
             if (file.isDirectory()) {
@@ -288,14 +407,14 @@ public class Files {
     }
 
     private static void delete() {
-        for (final String path : delete) {
+        for (final String path : DELETE) {
             delete(new File(path));
         }
     }
 
     /**
      * Delete a file and all contents if specified file is a directory.
-     * If the delete fails then the file/s are flagged for delete on exit.
+     * If the DELETE fails then the file/s are flagged for DELETE on exit.
      *
      * @param file File
      */
@@ -350,9 +469,16 @@ public class Files {
         }
     }
 
+    /**
+     *
+     * @param dir File
+     * @param pattern String
+     * @return File
+     * @Throws IllegalStateException on failure at any point
+     */
     public static File select(final File dir, final String pattern) {
         final List<File> matches = collect(dir, pattern);
-        if (matches.size() == 0) {
+        if (matches.isEmpty()) {
             throw new IllegalStateException(String.format("Missing '%s'", 
pattern));
         }
         if (matches.size() > 1) {
@@ -362,7 +488,7 @@ public class Files {
     }
 
     private static String join(final String delimiter, final Collection<File> 
collection) {
-        if (collection.size() == 0) {
+        if (collection.isEmpty()) {
             return "";
         }
         final StringBuilder sb = new StringBuilder();
@@ -374,6 +500,11 @@ public class Files {
 
     // return the token as url if simply a path otheriwse if ending by *.jar 
returning the list of
     // files in the folder
+    /**
+     *
+     * @param path String
+     * @return List of files in the folder
+     */
     public static Set<URL> listJars(final String path) {
         final Set<URL> set = new HashSet<>();
 
@@ -423,6 +554,12 @@ public class Files {
         return set;
     }
 
+    /**
+     *
+     * @param url URL
+     * @return File
+     * @Throws IllegalStateException on failure at any point
+     */
     public static File toFile(final URL url) {
         if ("jar".equals(url.getProtocol())) {
             try {
@@ -451,8 +588,14 @@ public class Files {
         }
     }
 
+    /**
+     *
+     * @param urls Set<URL>
+     * @param algo String
+     * @return String
+     */
     public static String hash(final Set<URL> urls, final String algo) {
-        final Collection<File> files = new ArrayList<File>();
+        final Collection<File> files = new ArrayList<>();
 
         for (final URL u : urls) {
             final File file = toFile(u);

http://git-wip-us.apache.org/repos/asf/tomee/blob/298cdee7/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java 
b/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
index 1a5f477..e73f2b5 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/IO.java
@@ -68,6 +68,12 @@ public class IO {
         MAX_TIMEOUT = timeout;
     }
 
+    /**
+     *
+     * @param uri URI
+     * @return String
+     * @throws IOException
+     */
     public static String readFileAsString(final URI uri) throws IOException {
         final StringBuilder builder = new StringBuilder("");
         for (final Proxy proxy : ProxySelector.getDefault().select(uri)) {
@@ -95,18 +101,44 @@ public class IO {
         return builder.toString();
     }
 
+    /**
+     *
+     * @param resource URL
+     * @return Properties
+     * @throws IOException
+     */
     public static Properties readProperties(final URL resource) throws 
IOException {
         return readProperties(resource, new Properties());
     }
 
+    /**
+     *
+     * @param resource URL
+     * @param properties Properties
+     * @return Properties
+     * @throws IOException
+     */
     public static Properties readProperties(final URL resource, final 
Properties properties) throws IOException {
         return readProperties(read(resource), properties);
     }
 
+    /**
+     *
+     * @param resource File
+     * @return Properties
+     * @throws IOException
+     */
     public static Properties readProperties(final File resource) throws 
IOException {
         return readProperties(resource, new Properties());
     }
 
+    /**
+     *
+     * @param resource File
+     * @param properties Properties
+     * @return Properties
+     * @throws IOException
+     */
     public static Properties readProperties(final File resource, final 
Properties properties) throws IOException {
         return readProperties(read(resource), properties);
     }
@@ -134,6 +166,12 @@ public class IO {
         return properties;
     }
 
+    /**
+     *
+     * @param url URL
+     * @return String
+     * @throws IOException
+     */
     public static String readString(final URL url) throws IOException {
         final InputStream in = url.openStream();
         try {
@@ -144,6 +182,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param file File
+     * @return String
+     * @throws IOException
+     */
     public static String readString(final File file) throws IOException {
         final FileReader in = new FileReader(file);
         try {
@@ -154,23 +198,46 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param file File
+     * @return String
+     * @throws IOException
+     */
     public static String slurp(final File file) throws IOException {
         try (final InputStream is = read(file)) {
             return slurp(is);
         }
     }
 
-
+    /**
+     *
+     * @param url URL
+     * @return String
+     * @throws IOException
+     */
     public static String slurp(final URL url) throws IOException {
         return slurp(url.openStream());
     }
 
+    /**
+     *
+     * @param in InputStream
+     * @return String
+     * @throws IOException
+     */
     public static String slurp(final InputStream in) throws IOException {
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
         copy(in, out);
         return new String(out.toByteArray());
     }
 
+    /**
+     *
+     * @param file File
+     * @param string String
+     * @throws IOException
+     */
     public static void writeString(final File file, final String string) 
throws IOException {
         final FileWriter out = new FileWriter(file);
         try {
@@ -186,6 +253,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from File
+     * @param to File
+     * @throws IOException
+     */
     public static void copy(final File from, final File to) throws IOException 
{
         if (!from.isDirectory()) {
             final FileOutputStream fos = new FileOutputStream(to);
@@ -199,6 +272,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param srcDir File
+     * @param destDir File
+     * @throws IOException
+     */
     public static void copyDirectory(final File srcDir, final File destDir) 
throws IOException {
         if (srcDir == null) {
             throw new NullPointerException("Source must not be null");
@@ -221,7 +300,7 @@ public class IO {
         if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) {
             final File[] srcFiles = srcDir.listFiles();
             if (srcFiles != null && srcFiles.length > 0) {
-                exclusionList = new ArrayList<String>(srcFiles.length);
+                exclusionList = new ArrayList<>(srcFiles.length);
                 for (final File srcFile : srcFiles) {
                     final File copiedFile = new File(destDir, 
srcFile.getName());
                     exclusionList.add(copiedFile.getCanonicalPath());
@@ -260,6 +339,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from File
+     * @param to OutputStream
+     * @throws IOException
+     */
     public static void copy(final File from, final OutputStream to) throws 
IOException {
         final InputStream read = read(from);
         try {
@@ -269,6 +354,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from URL
+     * @param to OutputStream
+     * @throws IOException
+     */
     public static void copy(final URL from, final OutputStream to) throws 
IOException {
         final InputStream read = read(from);
         try {
@@ -278,6 +369,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from InputStream
+     * @param to File
+     * @throws IOException
+     */
     public static void copy(final InputStream from, final File to) throws 
IOException {
         final OutputStream write = write(to);
         try {
@@ -287,6 +384,13 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from InputStream
+     * @param to File
+     * @param append boolean
+     * @throws IOException
+     */
     public static void copy(final InputStream from, final File to, final 
boolean append) throws IOException {
         final OutputStream write = write(to, append);
         try {
@@ -296,6 +400,12 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param from InputStream
+     * @param to OutputStream
+     * @throws IOException
+     */
     public static void copy(final InputStream from, final OutputStream to) 
throws IOException {
         final byte[] buffer = new byte[1024];
         int length;
@@ -305,24 +415,52 @@ public class IO {
         to.flush();
     }
 
+    /**
+     *
+     * @param from byte[]
+     * @param to File
+     * @throws IOException
+     */
     public static void copy(final byte[] from, final File to) throws 
IOException {
         copy(new ByteArrayInputStream(from), to);
     }
 
+    /**
+     *
+     * @param from byte[]
+     * @param to OutputStream
+     * @throws IOException
+     */
     public static void copy(final byte[] from, final OutputStream to) throws 
IOException {
         copy(new ByteArrayInputStream(from), to);
     }
 
+    /**
+     *
+     * @param file File
+     * @return ZipOutputStream
+     * @throws IOException
+     */
     public static ZipOutputStream zip(final File file) throws IOException {
         final OutputStream write = write(file);
         return new ZipOutputStream(write);
     }
 
+    /**
+     *
+     * @param file File
+     * @return ZipInputStream
+     * @throws IOException
+     */
     public static ZipInputStream unzip(final File file) throws IOException {
         final InputStream read = read(file);
         return new ZipInputStream(read);
     }
 
+    /**
+     *
+     * @param closeable Closeable
+     */
     public static void close(final Closeable closeable) {
         if (closeable == null) {
             return;
@@ -341,45 +479,92 @@ public class IO {
         }
     }
 
+    /**
+     *
+     * @param file File
+     * @return boolean
+     */
     public static boolean delete(final File file) {
         if (file == null) {
             return false;
         }
         if (!file.delete()) {
-            Logger.getLogger(IO.class.getName()).log(Level.WARNING, "Delete 
failed on: " + file.getAbsolutePath());
+            Logger.getLogger(IO.class.getName()).log(Level.WARNING, "Delete 
failed on: {0}", file.getAbsolutePath());
             return false;
         }
 
         return true;
     }
 
+    /**
+     *
+     * @param destination File
+     * @return OutputStream
+     * @throws FileNotFoundException
+     */
     public static OutputStream write(final File destination) throws 
FileNotFoundException {
         final OutputStream out = new FileOutputStream(destination);
         return new BufferedOutputStream(out, 32768);
     }
 
+    /**
+     *
+     * @param destination File
+     * @param append boolean
+     * @return OutputStream
+     * @throws FileNotFoundException
+     */
     public static OutputStream write(final File destination, final boolean 
append) throws FileNotFoundException {
         final OutputStream out = new FileOutputStream(destination, append);
         return new BufferedOutputStream(out, 32768);
     }
 
+    /**
+     *
+     * @param source File
+     * @return InputStream
+     * @throws FileNotFoundException
+     */
     public static InputStream read(final File source) throws 
FileNotFoundException {
         final InputStream in = new FileInputStream(source);
         return new BufferedInputStream(in, 32768);
     }
 
+    /**
+     *
+     * @param content String
+     * @return InputStream
+     */
     public static InputStream read(final String content) {
         return read(content.getBytes());
     }
 
+    /**
+     *
+     * @param content String
+     * @param encoding String
+     * @return InputStream
+     * @throws UnsupportedEncodingException
+     */
     public static InputStream read(final String content, final String 
encoding) throws UnsupportedEncodingException {
         return read(content.getBytes(encoding));
     }
 
+    /**
+     *
+     * @param content byte[]
+     * @return InputStream
+     */
     public static InputStream read(final byte[] content) {
         return new ByteArrayInputStream(content);
     }
 
+    /**
+     *
+     * @param url URL
+     * @return InputStream
+     * @throws IOException
+     */
     public static InputStream read(final URL url) throws IOException {
         return url.openStream();
     }

Reply via email to