Divide the MSB source codes into two repos
[msb/apigateway.git] / apiroute / apiroute-service / src / main / java / org / onap / msb / apiroute / wrapper / util / FileUtil.java
@@ -1,5 +1,5 @@
 /**
- * Copyright 2016 ZTE Corporation.
+ * Copyright 2016 ZTE, Inc. and others.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.openo.msb.wrapper.util;
+
+package org.onap.msb.apiroute.wrapper.util;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -39,14 +40,14 @@ public final class FileUtil {
 
     public static String readFile(String Path) throws IOException{
         BufferedReader reader = null;
-        String fileContent = "";
+        StringBuffer fileContent = new StringBuffer();
         try {
             FileInputStream fileInputStream = new FileInputStream(Path);
             InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
             reader = new BufferedReader(inputStreamReader);
             String tempString = null;
             while ((tempString = reader.readLine()) != null) {
-                fileContent += tempString;
+                fileContent.append(tempString);
             }
             reader.close();
         } catch (IOException e) {
@@ -60,6 +61,18 @@ public final class FileUtil {
                 }
             }
         }
-        return fileContent;
+        return fileContent.toString();
+    }
+    
+    /**
+     * Read all the files under a folder
+     */
+    public static String[] readfile(String filepath) throws FileNotFoundException, IOException {
+        File file = new File(filepath);
+        if (file.isDirectory()) {
+            String[] filelist = file.list();
+            return filelist;
+        }
+        return null;
     }
 }