Package se.datadosen.util
Class TargetPage
java.lang.Object
se.datadosen.util.TargetPage
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 Summary
ConstructorsConstructorDescriptionTargetPage
(File file) Creates a TargetPage thereby spawning a background task that loads the existing contents -
Method Summary
Modifier and TypeMethodDescriptionboolean
writeChanges
(String newContent, String charsetName) Write new contents to disk if changes have been made.boolean
writeChanges
(String newContent, Charset charset) Write new contents to disk if changes have been made.writeChangesBg
(String newContent, String charsetName) Write new contents to disk if changes have been made.Uses a background task for processing.writeChangesBg
(String newContent, Charset charset) Write new contents to disk if changes have been made.Uses a background task for processing.
-
Constructor Details
-
TargetPage
Creates a TargetPage thereby spawning a background task that loads the existing contents- Parameters:
file
-
-
-
Method Details
-
writeChanges
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
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
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
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:
-