Class IOUtil

    • Method Detail

      • createWriter

        public static Writer createWriter()
        Deprecated.
      • createWriter

        public static Writer createWriter​(String reportFile)
        Deprecated.
        Creates a writer that writes to the given file or to stdout. The file is created if it does not exist.

        Warning: This writer always uses the system default charset.

        Parameters:
        reportFile - the file name (optional)
        Returns:
        the writer, never null
      • createWriter

        public static Writer createWriter​(Charset charset,
                                          String reportFile)
        Deprecated.
        Creates a writer that writes to the given file or to stdout. The file is created if it does not exist.

        Unlike createWriter(String), this method always uses the given charset. Even for writing to stdout. It never falls back to the default charset.

        Parameters:
        charset - the charset to be used (required)
        reportFile - the file name (optional)
        Returns:
      • skipBOM

        public static Reader skipBOM​(Reader source)
        Deprecated.
      • tryCloseClassLoader

        public static void tryCloseClassLoader​(ClassLoader classLoader)
        Deprecated.
      • closeAll

        public static IOException closeAll​(Collection<? extends AutoCloseable> closeables)
        Deprecated.
        Close all closeable resources in order. If any exception occurs, it is saved and returned. If more than one exception occurs, the following are accumulated as suppressed exceptions in the first.
        Parameters:
        closeables - Resources to close
        Returns:
        An exception, or null if no 'close' routine threw
      • ensureClosed

        public static void ensureClosed​(List<? extends AutoCloseable> toClose,
                                        Exception pendingException)
                                 throws Exception
        Deprecated.
        Ensure that the closeables are closed. In the end, throws the pending exception if not null, or the exception retuned by closeAll(Collection) if not null. If both are non-null, adds one of them to the suppress list of the other, and throws that one.
        Throws:
        Exception