Class LargeFileSubstitutionHandler

  • All Implemented Interfaces:
    Substitutable

    public class LargeFileSubstitutionHandler
    extends FileSubstitutionHandler
    Creates Reader and Writer for the String substitution file. Implementation is useful for large files which cann't be read entirely in a memory or need a substantial amount of memory.

    To perform substitution it take helps of temporary file to write output, after substitution, temporary file renamed to input file.

    • Method Detail

      • getReader

        public Reader getReader()
        Description copied from interface: Substitutable
        Gets the character stream from the input.

        Implementation note: It is a good idea for the input stream to be buffered.

        Returns:
        A Reader.
      • getWriter

        public Writer getWriter()
        Description copied from interface: Substitutable
        Gets the Writer object to write the character stream in to the output.

        Implementation note: It is a good idea for the output stream to be buffered.

        Returns:
        A Writer.
      • finish

        public void finish()
        Description copied from interface: Substitutable
        Called at the completion of the substitution process to perform post operation. For e.g closing of reader/writer, cleaning of the temporary data... etc.
        Specified by:
        finish in interface Substitutable
        Overrides:
        finish in class FileSubstitutionHandler