From e4ceb9784b882adb2a7574b0581cb1fa09c36c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Gond=C5=BEa?= Date: Fri, 31 May 2024 15:10:17 +0200 Subject: [PATCH] feat(): Buffer File Target to improve the writing performance --- src/main/java/com/github/olivergondza/saxeed/Target.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/olivergondza/saxeed/Target.java b/src/main/java/com/github/olivergondza/saxeed/Target.java index f58e05c..549c542 100644 --- a/src/main/java/com/github/olivergondza/saxeed/Target.java +++ b/src/main/java/com/github/olivergondza/saxeed/Target.java @@ -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. @@ -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); }