Class IOUtils


  • public class IOUtils
    extends Object
    A utility class for I/O related functionality.
    • Constructor Detail

      • IOUtils

        public IOUtils()
    • Method Detail

      • copyBytes

        public static void copyBytes​(InputStream is,
                                     OutputStream os)
                              throws IOException
        Reads bytes from the given input stream and writes them to the given output stream until the end of the input stream is reached.
        Parameters:
        is - the input stream
        os - the output stream
        Throws:
        IOException - if an I/O error occurs
      • createDir

        public static boolean createDir​(File dir)
                                 throws IOException
        Creates the specified directory. Does nothing if the directory already exists otherwise it is created. If creation fails, an I/O exception is thrown.
        Parameters:
        dir - the directory to be created
        Returns:
        true if it has been created, false if the directory already exists
        Throws:
        IOException - if the directory could not be created