Class FilenameGenerator


  • public class FilenameGenerator
    extends java.lang.Object
    Class for generating filenames for temporary files.
    Version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String path  
      private java.lang.String suffix  
      private long value  
    • Constructor Summary

      Constructors 
      Constructor Description
      FilenameGenerator​(java.lang.String path, java.lang.String initialValue, java.lang.String suffix)
      Create a new filename generator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String generateFilename()
      Generate a filename.
      java.lang.String getInitialValue()
      Returns the current initial value of the base file names generated.
      java.lang.String getPath()
      Returns the path setting of this filename generator.
      java.lang.String getSuffix()
      Returns the suffix setting of this filename generator.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • path

        private java.lang.String path
      • value

        private long value
      • suffix

        private java.lang.String suffix
    • Constructor Detail

      • FilenameGenerator

        public FilenameGenerator​(java.lang.String path,
                                 java.lang.String initialValue,
                                 java.lang.String suffix)
                          throws java.lang.NumberFormatException
        Create a new filename generator. The generated filenames will point to the specified directory path. The base file name is a sequential number. The specified suffix is appended to the final file name.
        Parameters:
        path - The path where the file are created. If null, the default file path from the ApfloatContext is used.
        initialValue - The initial value for the numbers. If null, the default file initial value from the ApfloatContext is used.
        suffix - The suffix for file names. If null, the default file suffix from the ApfloatContext is used.
        Throws:
        java.lang.NumberFormatException - If initialValue is not a valid integer number.
    • Method Detail

      • generateFilename

        public java.lang.String generateFilename()
        Generate a filename. The returned filename is unique among those generated by this filename generator.
        Returns:
        A generated file name.
      • getPath

        public java.lang.String getPath()
        Returns the path setting of this filename generator.
        Returns:
        The path setting of this filename generator.
      • getInitialValue

        public java.lang.String getInitialValue()
        Returns the current initial value of the base file names generated.
        Returns:
        The current initial value of the base file names generated.
      • getSuffix

        public java.lang.String getSuffix()
        Returns the suffix setting of this filename generator.
        Returns:
        The suffix setting of this filename generator.