Package aQute.lib.io

Class IO


  • public class IO
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.io.File home  
      static java.io.OutputStream nullStream  
      static java.io.Writer nullWriter  
      static java.io.File work  
    • Constructor Summary

      Constructors 
      Constructor Description
      IO()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Throwable close​(java.io.Closeable in)  
      static java.lang.String collect​(java.io.File file)  
      static java.lang.String collect​(java.io.File file, java.lang.String encoding)  
      static java.lang.String collect​(java.io.File file, java.nio.charset.Charset encoding)  
      static java.lang.String collect​(java.io.InputStream in)  
      static java.lang.String collect​(java.io.InputStream in, java.lang.String encoding)  
      static java.lang.String collect​(java.io.InputStream in, java.nio.charset.Charset encoding)  
      static java.lang.String collect​(java.io.Reader r)  
      static java.lang.String collect​(java.lang.String path)  
      static java.lang.String collect​(java.net.URL url)  
      static java.lang.String collect​(java.net.URL url, java.lang.String encoding)  
      static java.lang.String collect​(java.net.URL url, java.nio.charset.Charset encoding)  
      static java.lang.String collect​(java.nio.ByteBuffer bb, java.nio.charset.Charset encoding)  
      static java.lang.String collect​(java.nio.file.Path path)  
      static java.lang.String collect​(java.nio.file.Path path, java.nio.charset.Charset encoding)  
      static java.io.File copy​(byte[] data, java.io.File file)  
      static java.io.OutputStream copy​(byte[] data, java.io.OutputStream out)  
      static java.io.Writer copy​(byte[] data, java.io.Writer w)  
      static java.nio.file.Path copy​(byte[] data, java.nio.file.Path path)  
      static java.io.File copy​(java.io.File src, java.io.File tgt)  
      static java.io.OutputStream copy​(java.io.File file, java.io.OutputStream out)  
      static java.security.MessageDigest copy​(java.io.File file, java.security.MessageDigest md)  
      static byte[] copy​(java.io.InputStream in, byte[] data)  
      static byte[] copy​(java.io.InputStream in, byte[] data, int off, int len)  
      static java.io.DataOutput copy​(java.io.InputStream in, java.io.DataOutput out)  
      static java.io.File copy​(java.io.InputStream in, java.io.File file)  
      static java.io.OutputStream copy​(java.io.InputStream in, java.io.OutputStream out)  
      static java.io.Writer copy​(java.io.InputStream in, java.io.Writer w)  
      static java.io.Writer copy​(java.io.InputStream in, java.io.Writer w, java.lang.String charset)  
      static java.io.Writer copy​(java.io.InputStream in, java.io.Writer w, java.nio.charset.Charset charset)  
      static java.net.URL copy​(java.io.InputStream in, java.net.URL url)  
      static java.net.URL copy​(java.io.InputStream in, java.net.URL url, java.lang.String method)  
      static java.nio.ByteBuffer copy​(java.io.InputStream in, java.nio.ByteBuffer bb)  
      static java.nio.channels.WritableByteChannel copy​(java.io.InputStream in, java.nio.channels.WritableByteChannel out)  
      static java.nio.file.Path copy​(java.io.InputStream in, java.nio.file.Path path)  
      static java.security.MessageDigest copy​(java.io.InputStream in, java.security.MessageDigest md)  
      static java.io.OutputStream copy​(java.io.Reader r, java.io.OutputStream out)  
      static java.io.OutputStream copy​(java.io.Reader r, java.io.OutputStream out, java.lang.String charset)  
      static java.io.OutputStream copy​(java.io.Reader r, java.io.OutputStream out, java.nio.charset.Charset charset)  
      static java.io.Writer copy​(java.io.Reader r, java.io.Writer w)  
      static java.io.File copy​(java.net.URLConnection conn, java.io.File file)  
      static java.security.MessageDigest copy​(java.net.URLConnection conn, java.security.MessageDigest md)  
      static java.io.File copy​(java.net.URL url, java.io.File file)  
      static java.security.MessageDigest copy​(java.net.URL url, java.security.MessageDigest md)  
      static java.io.OutputStream copy​(java.nio.ByteBuffer bb, java.io.OutputStream out)  
      static java.io.OutputStream copy​(java.nio.channels.ReadableByteChannel in, java.io.OutputStream out)  
      static java.nio.channels.WritableByteChannel copy​(java.nio.channels.ReadableByteChannel in, java.nio.channels.WritableByteChannel out)  
      static java.security.MessageDigest copy​(java.nio.channels.ReadableByteChannel in, java.security.MessageDigest md)  
      static java.io.OutputStream copy​(java.nio.file.Path path, java.io.OutputStream out)  
      static java.nio.file.Path copy​(java.nio.file.Path src, java.nio.file.Path tgt)  
      static java.security.MessageDigest copy​(java.nio.file.Path path, java.security.MessageDigest md)  
      static java.io.OutputStream copy​(java.util.Collection<?> c, java.io.OutputStream out)  
      static boolean createSymbolicLink​(java.io.File link, java.io.File target)  
      static boolean createSymbolicLink​(java.nio.file.Path link, java.nio.file.Path target)  
      static boolean createSymbolicLinkOrCopy​(java.io.File link, java.io.File target)
      Creates a symbolic link from link to the target, or copies target to link if running on Windows.
      static boolean createSymbolicLinkOrCopy​(java.nio.file.Path link, java.nio.file.Path target)
      Creates a symbolic link from link to the target, or copies target to link if running on Windows.
      static java.io.File createTempFile​(java.io.File directory, java.lang.String pattern, java.lang.String suffix)
      Create a temporary file.
      static java.nio.CharBuffer decode​(java.nio.ByteBuffer bb, java.nio.charset.Charset encoding)  
      static void delete​(java.io.File file)
      Deletes the specified file.
      static void delete​(java.nio.file.Path path)
      Deletes the specified path.
      static void deleteWithException​(java.io.File file)
      Deletes the specified file.
      static void deleteWithException​(java.nio.file.Path path)
      Deletes the specified path.
      static long drain​(java.io.InputStream in)  
      static java.nio.ByteBuffer encode​(java.nio.CharBuffer cb, java.nio.charset.Charset encoding)  
      static java.lang.String getExtension​(java.lang.String fileName, java.lang.String deflt)  
      static java.io.File getFile​(java.io.File base, java.lang.String file)  
      static java.io.File getFile​(java.lang.String filename)  
      static void initialize​(java.io.File dir)
      Deletes and creates directories
      static boolean isSymbolicLink​(java.io.File link)  
      static boolean isSymbolicLink​(java.nio.file.Path link)  
      static boolean isWindows()  
      static void mkdirs​(java.io.File dir)  
      static void mkdirs​(java.nio.file.Path dir)  
      static java.io.OutputStream outputStream​(java.io.File file)  
      static java.io.OutputStream outputStream​(java.nio.file.Path path)  
      static byte[] read​(java.io.File file)  
      static byte[] read​(java.io.InputStream in)  
      static byte[] read​(java.net.URL url)  
      static byte[] read​(java.nio.ByteBuffer bb)  
      static java.nio.ByteBuffer read​(java.nio.file.Path path)  
      static java.nio.channels.FileChannel readChannel​(java.nio.file.Path path)  
      static java.io.BufferedReader reader​(java.io.File file)  
      static java.io.BufferedReader reader​(java.io.File file, java.lang.String encoding)  
      static java.io.BufferedReader reader​(java.io.File file, java.nio.charset.Charset encoding)  
      static java.io.BufferedReader reader​(java.io.InputStream in)  
      static java.io.BufferedReader reader​(java.io.InputStream in, java.lang.String encoding)  
      static java.io.BufferedReader reader​(java.io.InputStream in, java.nio.charset.Charset encoding)  
      static java.io.BufferedReader reader​(java.lang.String s)  
      static java.io.BufferedReader reader​(java.nio.ByteBuffer bb, java.nio.charset.Charset encoding)  
      static java.io.BufferedReader reader​(java.nio.channels.ReadableByteChannel in, java.nio.charset.Charset encoding)  
      static java.io.BufferedReader reader​(java.nio.CharBuffer cb)  
      static java.io.BufferedReader reader​(java.nio.file.Path path, java.nio.charset.Charset encoding)  
      static void rename​(java.io.File from, java.io.File to)
      Renames from to to replacing the target file if necessary.
      static void rename​(java.nio.file.Path from, java.nio.file.Path to)
      Renames from to to replacing the target file if necessary.
      static void store​(java.lang.Object o, java.io.File file)  
      static void store​(java.lang.Object o, java.io.File file, java.lang.String encoding)  
      static void store​(java.lang.Object o, java.io.OutputStream out)  
      static void store​(java.lang.Object o, java.io.OutputStream out, java.lang.String encoding)  
      static void store​(java.lang.Object o, java.io.OutputStream out, java.nio.charset.Charset encoding)  
      static void store​(java.lang.Object o, java.io.Writer w)  
      static void store​(java.lang.Object o, java.nio.file.Path path, java.nio.charset.Charset encoding)  
      static java.io.InputStream stream​(byte[] data)  
      static java.io.InputStream stream​(java.io.File file)  
      static java.io.InputStream stream​(java.lang.String s)  
      static java.io.InputStream stream​(java.lang.String s, java.lang.String encoding)  
      static java.io.InputStream stream​(java.lang.String s, java.nio.charset.Charset encoding)  
      static java.io.InputStream stream​(java.net.URL url)  
      static java.io.InputStream stream​(java.nio.ByteBuffer bb)  
      static java.io.InputStream stream​(java.nio.file.Path path)  
      static java.lang.String toSafeFileName​(java.lang.String string)  
      static java.net.URL toURL​(java.lang.String s, java.io.File base)  
      static java.util.Collection<java.io.File> tree​(java.io.File current)  
      static java.util.Collection<java.io.File> tree​(java.io.File current, java.lang.String glob)  
      static void write​(byte[] data, java.io.File file)  
      static void write​(byte[] data, java.io.OutputStream out)  
      static java.nio.channels.FileChannel writeChannel​(java.nio.file.Path path)  
      static java.io.PrintWriter writer​(java.io.File file)  
      static java.io.PrintWriter writer​(java.io.File file, java.lang.String encoding)  
      static java.io.PrintWriter writer​(java.io.File file, java.nio.charset.Charset encoding)  
      static java.io.PrintWriter writer​(java.io.OutputStream out)  
      static java.io.PrintWriter writer​(java.io.OutputStream out, java.lang.String encoding)  
      static java.io.PrintWriter writer​(java.io.OutputStream out, java.nio.charset.Charset encoding)  
      static java.io.PrintWriter writer​(java.nio.channels.WritableByteChannel out, java.nio.charset.Charset encoding)  
      static java.io.PrintWriter writer​(java.nio.file.Path path, java.nio.charset.Charset encoding)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • work

        public static final java.io.File work
      • home

        public static final java.io.File home
      • nullStream

        public static final java.io.OutputStream nullStream
      • nullWriter

        public static final java.io.Writer nullWriter
    • Constructor Detail

      • IO

        public IO()
    • Method Detail

      • getExtension

        public static java.lang.String getExtension​(java.lang.String fileName,
                                                    java.lang.String deflt)
      • tree

        public static java.util.Collection<java.io.File> tree​(java.io.File current)
      • tree

        public static java.util.Collection<java.io.File> tree​(java.io.File current,
                                                              java.lang.String glob)
      • copy

        public static java.io.File copy​(byte[] data,
                                        java.io.File file)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.file.Path copy​(byte[] data,
                                              java.nio.file.Path path)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.Writer copy​(byte[] data,
                                          java.io.Writer w)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(byte[] data,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.Writer copy​(java.io.Reader r,
                                          java.io.Writer w)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.io.Reader r,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.io.Reader r,
                                                java.io.OutputStream out,
                                                java.lang.String charset)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.io.Reader r,
                                                java.io.OutputStream out,
                                                java.nio.charset.Charset charset)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.Writer copy​(java.io.InputStream in,
                                          java.io.Writer w)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.Writer copy​(java.io.InputStream in,
                                          java.io.Writer w,
                                          java.lang.String charset)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.Writer copy​(java.io.InputStream in,
                                          java.io.Writer w,
                                          java.nio.charset.Charset charset)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.io.InputStream in,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.DataOutput copy​(java.io.InputStream in,
                                              java.io.DataOutput out)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.channels.WritableByteChannel copy​(java.nio.channels.ReadableByteChannel in,
                                                                 java.nio.channels.WritableByteChannel out)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.ByteBuffer copy​(java.io.InputStream in,
                                               java.nio.ByteBuffer bb)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static byte[] copy​(java.io.InputStream in,
                                  byte[] data)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static byte[] copy​(java.io.InputStream in,
                                  byte[] data,
                                  int off,
                                  int len)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.nio.ByteBuffer bb,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.net.URL url,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.io.File file,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.nio.file.Path path,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.net.URLConnection conn,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.io.InputStream in,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.security.MessageDigest copy​(java.nio.channels.ReadableByteChannel in,
                                                       java.security.MessageDigest md)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.File copy​(java.net.URL url,
                                        java.io.File file)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.File copy​(java.net.URLConnection conn,
                                        java.io.File file)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.net.URL copy​(java.io.InputStream in,
                                        java.net.URL url)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.net.URL copy​(java.io.InputStream in,
                                        java.net.URL url,
                                        java.lang.String method)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.File copy​(java.io.File src,
                                        java.io.File tgt)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.file.Path copy​(java.nio.file.Path src,
                                              java.nio.file.Path tgt)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.File copy​(java.io.InputStream in,
                                        java.io.File file)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.file.Path copy​(java.io.InputStream in,
                                              java.nio.file.Path path)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.io.File file,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.nio.file.Path path,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.nio.channels.WritableByteChannel copy​(java.io.InputStream in,
                                                                 java.nio.channels.WritableByteChannel out)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.nio.channels.ReadableByteChannel in,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static byte[] read​(java.io.File file)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static java.nio.ByteBuffer read​(java.nio.file.Path path)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static byte[] read​(java.nio.ByteBuffer bb)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static byte[] read​(java.net.URL url)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public static byte[] read​(java.io.InputStream in)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public static void write​(byte[] data,
                                 java.io.OutputStream out)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • write

        public static void write​(byte[] data,
                                 java.io.File file)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • collect

        public static java.lang.String collect​(java.io.File file)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.File file,
                                               java.lang.String encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.File file,
                                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.nio.file.Path path)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.nio.file.Path path,
                                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.nio.ByteBuffer bb,
                                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.net.URL url,
                                               java.lang.String encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.net.URL url,
                                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.net.URL url)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.lang.String path)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.InputStream in)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.InputStream in,
                                               java.lang.String encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.InputStream in,
                                               java.nio.charset.Charset encoding)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • collect

        public static java.lang.String collect​(java.io.Reader r)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • createTempFile

        public static java.io.File createTempFile​(java.io.File directory,
                                                  java.lang.String pattern,
                                                  java.lang.String suffix)
                                           throws java.lang.IllegalArgumentException,
                                                  java.io.IOException
        Create a temporary file.
        Parameters:
        directory - the directory in which to create the file. Can be null, in which case the system TMP directory is used
        pattern - the filename prefix pattern. Must be at least 3 characters long
        suffix - the filename suffix. Can be null, in which case (system) default suffix is used
        Returns:
        temp file
        Throws:
        java.lang.IllegalArgumentException - when pattern is null or too short
        java.io.IOException - when the specified (non-null) directory is not a directory
      • getFile

        public static java.io.File getFile​(java.lang.String filename)
      • getFile

        public static java.io.File getFile​(java.io.File base,
                                           java.lang.String file)
      • delete

        public static void delete​(java.io.File file)
        Deletes the specified file. Folders are recursively deleted.
        If file(s) cannot be deleted, no feedback is provided (fail silently).
        Parameters:
        file - file to be deleted
      • delete

        public static void delete​(java.nio.file.Path path)
        Deletes the specified path. Folders are recursively deleted.
        If file(s) cannot be deleted, no feedback is provided (fail silently).
        Parameters:
        path - path to be deleted
      • initialize

        public static void initialize​(java.io.File dir)
        Deletes and creates directories
      • deleteWithException

        public static void deleteWithException​(java.io.File file)
                                        throws java.io.IOException
        Deletes the specified file. Folders are recursively deleted.
        Throws exception if any of the files could not be deleted.
        Parameters:
        file - file to be deleted
        Throws:
        java.io.IOException - if the file (or contents of a folder) could not be deleted
      • deleteWithException

        public static void deleteWithException​(java.nio.file.Path path)
                                        throws java.io.IOException
        Deletes the specified path. Folders are recursively deleted.
        Throws exception if any of the files could not be deleted.
        Parameters:
        path - path to be deleted
        Throws:
        java.io.IOException - if the path (or contents of a folder) could not be deleted
      • rename

        public static void rename​(java.io.File from,
                                  java.io.File to)
                           throws java.io.IOException
        Renames from to to replacing the target file if necessary.
        Parameters:
        from - source file
        to - destination file
        Throws:
        java.io.IOException - if the rename operation fails
      • rename

        public static void rename​(java.nio.file.Path from,
                                  java.nio.file.Path to)
                           throws java.io.IOException
        Renames from to to replacing the target file if necessary.
        Parameters:
        from - source path
        to - destination path
        Throws:
        java.io.IOException - if the rename operation fails
      • mkdirs

        public static void mkdirs​(java.io.File dir)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • mkdirs

        public static void mkdirs​(java.nio.file.Path dir)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • drain

        public static long drain​(java.io.InputStream in)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • copy

        public static java.io.OutputStream copy​(java.util.Collection<?> c,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public static java.lang.Throwable close​(java.io.Closeable in)
      • toURL

        public static java.net.URL toURL​(java.lang.String s,
                                         java.io.File base)
                                  throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.File file)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.File file,
                                 java.lang.String encoding)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.nio.file.Path path,
                                 java.nio.charset.Charset encoding)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.OutputStream out)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.OutputStream out,
                                 java.lang.String encoding)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.OutputStream out,
                                 java.nio.charset.Charset encoding)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • store

        public static void store​(java.lang.Object o,
                                 java.io.Writer w)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • stream

        public static java.io.InputStream stream​(byte[] data)
      • stream

        public static java.io.InputStream stream​(java.nio.ByteBuffer bb)
      • stream

        public static java.io.InputStream stream​(java.lang.String s)
      • stream

        public static java.io.InputStream stream​(java.lang.String s,
                                                 java.lang.String encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • stream

        public static java.io.InputStream stream​(java.lang.String s,
                                                 java.nio.charset.Charset encoding)
      • stream

        public static java.io.InputStream stream​(java.io.File file)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • stream

        public static java.io.InputStream stream​(java.nio.file.Path path)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • stream

        public static java.io.InputStream stream​(java.net.URL url)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readChannel

        public static java.nio.channels.FileChannel readChannel​(java.nio.file.Path path)
                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • outputStream

        public static java.io.OutputStream outputStream​(java.io.File file)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • outputStream

        public static java.io.OutputStream outputStream​(java.nio.file.Path path)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeChannel

        public static java.nio.channels.FileChannel writeChannel​(java.nio.file.Path path)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • decode

        public static java.nio.CharBuffer decode​(java.nio.ByteBuffer bb,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • encode

        public static java.nio.ByteBuffer encode​(java.nio.CharBuffer cb,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.lang.String s)
      • reader

        public static java.io.BufferedReader reader​(java.io.File file)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.File file,
                                                    java.lang.String encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.File file,
                                                    java.nio.charset.Charset encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.nio.file.Path path,
                                                    java.nio.charset.Charset encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.nio.ByteBuffer bb,
                                                    java.nio.charset.Charset encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.nio.CharBuffer cb)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.nio.channels.ReadableByteChannel in,
                                                    java.nio.charset.Charset encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.InputStream in)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.InputStream in,
                                                    java.lang.String encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • reader

        public static java.io.BufferedReader reader​(java.io.InputStream in,
                                                    java.nio.charset.Charset encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.File file)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.File file,
                                                 java.lang.String encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.File file,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.nio.file.Path path,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.nio.channels.WritableByteChannel out,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.OutputStream out)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.OutputStream out,
                                                 java.lang.String encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writer

        public static java.io.PrintWriter writer​(java.io.OutputStream out,
                                                 java.nio.charset.Charset encoding)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • createSymbolicLink

        public static boolean createSymbolicLink​(java.io.File link,
                                                 java.io.File target)
                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createSymbolicLink

        public static boolean createSymbolicLink​(java.nio.file.Path link,
                                                 java.nio.file.Path target)
                                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isSymbolicLink

        public static boolean isSymbolicLink​(java.io.File link)
      • isSymbolicLink

        public static boolean isSymbolicLink​(java.nio.file.Path link)
      • createSymbolicLinkOrCopy

        public static boolean createSymbolicLinkOrCopy​(java.io.File link,
                                                       java.io.File target)
        Creates a symbolic link from link to the target, or copies target to link if running on Windows.

        Creating symbolic links on Windows requires administrator permissions, so copying is a safer fallback. Copy only happens if timestamp and and file length are different than target

        Parameters:
        link - the location of the symbolic link, or destination of the copy.
        target - the source of the symbolic link, or source of the copy.
        Returns:
        true if the operation succeeds, false otherwise.
      • createSymbolicLinkOrCopy

        public static boolean createSymbolicLinkOrCopy​(java.nio.file.Path link,
                                                       java.nio.file.Path target)
        Creates a symbolic link from link to the target, or copies target to link if running on Windows.

        Creating symbolic links on Windows requires administrator permissions, so copying is a safer fallback. Copy only happens if timestamp and and file length are different than target

        Parameters:
        link - the location of the symbolic link, or destination of the copy.
        target - the source of the symbolic link, or source of the copy.
        Returns:
        true if the operation succeeds, false otherwise.
      • toSafeFileName

        public static java.lang.String toSafeFileName​(java.lang.String string)
      • isWindows

        public static boolean isWindows()