Fix gvnfm juju compile problem
[vfc/nfvo/driver/vnfm/gvnfm.git] / juju / juju-vnfmadapter / Juju-vnfmadapterService / service / src / test / java / org / onap / vfc / nfvo / vnfm / gvnfm / jujuvnfmadapter / common / FileUtil.java
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common;
18
19 import java.io.BufferedReader;
20 import java.io.File;
21 import java.io.FileReader;
22 import java.io.IOException;
23
24 public class FileUtil {
25
26     public static String ReadFile(String path) {
27         File file = new File(path);
28         BufferedReader reader = null;
29         String laststr = "";
30         try {
31             reader = new BufferedReader(new FileReader(file));
32             String tempString = null;
33             while((tempString = reader.readLine()) != null) {
34                 laststr = laststr + tempString;
35             }
36             reader.close();
37         } catch(IOException e) {
38             e.printStackTrace();
39         } finally {
40             if(reader != null) {
41                 try {
42                     reader.close();
43                 } catch(IOException e1) {
44                 }
45             }
46         }
47         return laststr;
48     }
49
50 }