Skip to content

Commit

Permalink
feat(): Buffer File Target to improve the writing performance
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergondza committed May 31, 2024
1 parent f06657d commit e4ceb97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/github/olivergondza/saxeed/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.file.Path;
import java.util.Objects;

/**
* Target to write the resulting content into.
Expand Down Expand Up @@ -70,7 +70,7 @@ public TransformationHandler getHandler(TransformationBuilder builder, XMLOutput

private OutputStream getOutputStream() throws FailedWriting {
try {
return new FileOutputStream(file);
return new BufferedOutputStream(new FileOutputStream(file));
} catch (FileNotFoundException e) {
throw new FailedWriting("Cannot create/open file: " + file.getAbsolutePath(), e);
}
Expand Down

0 comments on commit e4ceb97

Please sign in to comment.