/**
- * 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.
* 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;
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) {
}
}
}
- 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;
}
}