Save overwriting original file

The following example demonstrates how to save the redacted document, replacing an original file:

// Make a copy of sample file
Files.copy(new File("Sample.docx").toPath(), new File("OverwrittenSample.docx").toPath(), StandardCopyOption.REPLACE_EXISTING);
// Apply redaction
final Redactor redactor = new Redactor("OverwrittenSample.docx");
    RedactorChangeLog result = redactor.apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(java.awt.Color.RED)));
    if (result.getStatus() != RedactionStatus.Failed)
        SaveOptions options = new  SaveOptions();
        // Save the document in original format overwriting original file;
finally { redactor.close(); }