Class FileUtils


  • public final class FileUtils
    extends java.lang.Object
    • Method Detail

      • getInputStreamForClasspathFile

        public static java.io.InputStream getInputStreamForClasspathFile​(java.lang.String path,
                                                                         java.lang.ClassLoader loader)
      • getStreamForClasspathFile

        public static java.io.InputStream getStreamForClasspathFile​(java.lang.String path,
                                                                    java.lang.ClassLoader loader)
                                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getStreamForUri

        public static java.io.InputStream getStreamForUri​(java.net.URI uri,
                                                          java.lang.ClassLoader loader)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getClassLoaders

        public static java.util.List<java.lang.ClassLoader> getClassLoaders()
        Returns default classloaders.
        Returns:
        a List of ClassLoader instances.
      • addLines

        public static boolean addLines​(java.lang.String uriString,
                                       java.util.Set<java.lang.String> set)
                                throws java.net.MalformedURLException,
                                       java.io.IOException
        Throws:
        java.net.MalformedURLException
        java.io.IOException
      • readFileOrThrow

        public static java.lang.String readFileOrThrow​(java.io.File file)
                                                throws java.io.IOException
        Reads the contents of a File.
        Parameters:
        file - TODO javadoc me please
        Returns:
        the content of file or null in case of an error
        Throws:
        java.io.IOException - if an I/O error occurred.
      • readFile

        public static java.lang.String readFile​(java.io.File file)
      • writeFileOrThrow

        public static void writeFileOrThrow​(java.io.File file,
                                            java.lang.CharSequence content)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFile

        public static boolean writeFile​(java.io.File file,
                                        java.lang.CharSequence content)
      • prepareFileOutputStream

        public static java.io.FileOutputStream prepareFileOutputStream​(java.io.File file)
                                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • prepareFileInputStream

        public static java.io.FileInputStream prepareFileInputStream​(java.io.File file)
                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • maybeDeleteFileOrThrow

        public static void maybeDeleteFileOrThrow​(java.io.File file)
                                           throws java.io.IOException
        Throws:
        java.io.IOException