Package io.hawt.util

Class IOHelper


  • public class IOHelper
    extends Object
    A collection of IO helpers
    • Constructor Detail

      • IOHelper

        public IOHelper()
    • Method Detail

      • close

        public static void close​(Closeable closeable,
                                 String name,
                                 org.slf4j.Logger log)
        Closes the given resource if it is available, logging any closing exceptions to the given log.
        Parameters:
        closeable - the object to close
        name - the name of the resource
        log - the log to use when reporting closure warnings, will use this class's own Logger if log == null
      • write

        public static void write​(File file,
                                 String text)
                          throws IOException
        Writes the text to the given file, overwriting the previous file if it existed.
        Throws:
        IOException
      • write

        public static void write​(File file,
                                 String text,
                                 boolean append)
                          throws IOException
        Writes the given text to the file; either in append mode or replace mode depending the append flag
        Throws:
        IOException
      • write

        public static void write​(File file,
                                 byte[] data,
                                 boolean append)
                          throws IOException
        Writes the given data to the file; either in append mode or replace mode depending the append flag
        Throws:
        IOException