Class RandomTempFile

  • All Implemented Interfaces:
    Serializable, Comparable<File>

    public class RandomTempFile
    extends File
    Extension of File that creates a temporary file with a specified name in Java's temporary directory, as declared in the JRE's system properties. The file is immediately filled with a specified amount of random ASCII data.
    Author:
    Jason Fulghum
    See Also:
    RandomInputStream, Serialized Form
    • Constructor Detail

      • RandomTempFile

        public RandomTempFile​(String filename,
                              long sizeInBytes)
                       throws IOException
        Creates, and fills, a temp file with the specified name and specified size of random ASCII data.
        Parameters:
        filename - The name for the new temporary file, within the Java temp directory as declared in the JRE's system properties.
        sizeInBytes - The amount of random ASCII data, in bytes, for the new temp file.
        Throws:
        IOException - If any problems were encountered creating the new temp file.
      • RandomTempFile

        public RandomTempFile​(String filename,
                              long sizeInBytes,
                              boolean binaryData)
                       throws IOException
        Creates, and fills, a temp file with the specified name and specified size of random binary or character data.
        Parameters:
        filename - The name for the new temporary file, within the Java temp directory as declared in the JRE's system properties.
        sizeInBytes - The amount of random ASCII data, in bytes, for the new temp file.
        binaryData - Whether to fill the file with binary or character data.
        Throws:
        IOException - If any problems were encountered creating the new temp file.