From bb3ed798031609df5d63236d7d7a164e20fc1a33 Mon Sep 17 00:00:00 2001 From: bd2019us Date: Sat, 13 Apr 2019 21:59:28 -0500 Subject: [PATCH] [STANBOL-1477] Wrap FileWriter with BufferedWriter for better performance --- .../main/java/org/apache/stanbol/rules/manager/KB.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rules/manager/src/main/java/org/apache/stanbol/rules/manager/KB.java b/rules/manager/src/main/java/org/apache/stanbol/rules/manager/KB.java index feb0db3e5..3fba84e63 100644 --- a/rules/manager/src/main/java/org/apache/stanbol/rules/manager/KB.java +++ b/rules/manager/src/main/java/org/apache/stanbol/rules/manager/KB.java @@ -16,6 +16,7 @@ */ package org.apache.stanbol.rules.manager; +import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; @@ -87,15 +88,16 @@ public void write(OutputStream outputStream) throws IOException { public void write(FileWriter fileWriter) throws IOException { boolean write = true; + BufferedWriter bw = new BufferedWriter(fileWriter); for (Rule rule : ruleList) { if (write) { - fileWriter.write(rule.toString()); + bw.write(rule.toString()); write = false; } else { - fileWriter.write(" . " + System.getProperty("line.separator") + rule.toString()); + bw.write(" . " + System.getProperty("line.separator") + rule.toString()); } } - fileWriter.close(); + bw.close(); } }