Class TargetPage

java.lang.Object
se.datadosen.util.TargetPage

public class TargetPage extends Object
Speeds up page creation by allowing better parallelism. Only writes to disk if changes to contents have been detected. The old content is loaded on a background thread so page processing can occur simultaneously between constructing a TargetPage and calling writeChanges. Furthermore, this class allows the final page to be eventually written on a background thread.
Since:
29.1
  • Constructor Details

    • TargetPage

      public TargetPage(File file)
      Creates a TargetPage thereby spawning a background task that loads the existing contents
      Parameters:
      file -
  • Method Details

    • writeChanges

      public boolean writeChanges(String newContent, Charset charset) throws IOException
      Write new contents to disk if changes have been made. Will pause until the old contents has been loaded
      Parameters:
      newContent -
      charset -
      Returns:
      true if changes were detected and written
      Throws:
      IOException
    • writeChanges

      public boolean writeChanges(String newContent, String charsetName) throws IOException
      Write new contents to disk if changes have been made. Will pause until the old contents has been loaded
      Parameters:
      newContent -
      charsetName -
      Returns:
      true if changes were detected and written
      Throws:
      IOException
    • writeChangesBg

      public Future writeChangesBg(String newContent, Charset charset)
      Write new contents to disk if changes have been made.Uses a background task for processing. On error, prints to System.err
      Parameters:
      newContent -
      charset -
      Returns:
    • writeChangesBg

      public Future writeChangesBg(String newContent, String charsetName)
      Write new contents to disk if changes have been made.Uses a background task for processing. On error, prints to System.err
      Parameters:
      newContent -
      charsetName -
      Returns: