Class IO


  • public class IO
    extends Object
    A class containing helper functions for general purpose file IO.
    • Field Detail

      • MAXIMUM_FILE_SIZE

        public static final int MAXIMUM_FILE_SIZE
        The maximum acceptable file size in bytes.
        See Also:
        Constant Field Values
    • Method Detail

      • makeNewFile

        public static void makeNewFile​(File root,
                                       String name)
        Create a file on the disk if it does not already exist.
        Parameters:
        root - The parent file.
        name - The name of the new file.
      • writeBytesToFile

        public static void writeBytesToFile​(byte[] bytes,
                                            File outputFile)
        Writes bytes into a file. If the resulting file would exceed the specified maximum file size, it is not written but removed instead.
        Parameters:
        bytes - The content to write
        outputFile - The file to write the content into.