From 4dc31c4eb1df623ae0272a7b0ee08b651be11ec7 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 31 Aug 2015 09:58:38 +0000 Subject: [PATCH] refs #508: Support Config File to run task at service startup https://support.d4science.org/issues/508 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-api@117740 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../executor/utils/IOUtility.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/org/gcube/vremanagement/executor/utils/IOUtility.java diff --git a/src/main/java/org/gcube/vremanagement/executor/utils/IOUtility.java b/src/main/java/org/gcube/vremanagement/executor/utils/IOUtility.java new file mode 100644 index 0000000..8ecfe79 --- /dev/null +++ b/src/main/java/org/gcube/vremanagement/executor/utils/IOUtility.java @@ -0,0 +1,24 @@ +package org.gcube.vremanagement.executor.utils; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +public abstract class IOUtility { + + public static String readFile(String filePath) throws IOException { + BufferedReader reader = new BufferedReader(new FileReader(filePath)); + String line = null; + StringBuilder stringBuilder = new StringBuilder(); + String ls = System.getProperty("line.separator"); + + while ((line = reader.readLine()) != null) { + stringBuilder.append(line); + stringBuilder.append(ls); + } + reader.close(); + + return stringBuilder.toString(); + } + +}