Use IOUtils to copy files
Change-Id: Ie4bdb1e40451b74c1b191188a255c333e74ba867
diff --git a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/tool/YangCompilerManager.java b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/tool/YangCompilerManager.java
index 1a67b1e..a7618ea 100644
--- a/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/tool/YangCompilerManager.java
+++ b/compiler/base/tool/src/main/java/org/onosproject/yang/compiler/tool/YangCompilerManager.java
@@ -16,6 +16,7 @@
package org.onosproject.yang.compiler.tool;
+import org.apache.commons.io.IOUtils;
import org.onosproject.yang.compiler.api.YangCompilationParam;
import org.onosproject.yang.compiler.api.YangCompiledOutput;
import org.onosproject.yang.compiler.api.YangCompilerException;
@@ -621,9 +622,8 @@
FileOutputStream fileOutputStream =
new FileOutputStream(serializedFile)) {
- while (inputStream.available() > 0) {
- fileOutputStream.write(inputStream.read());
- }
+ IOUtils.copy(inputStream, fileOutputStream);
+ fileOutputStream.close();
if (serializedFile.getName().endsWith(YANG_META_DATA)) {
model = deSerializeDataModel(serializedFile.toString());
}