summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satserver/util/Util.java
diff options
context:
space:
mode:
authorSimon Rettberg2014-11-18 18:40:49 +0100
committerSimon Rettberg2014-11-18 18:40:49 +0100
commitecb072b02e1a70555db0fdf4ed47375d3080a074 (patch)
tree75db05621458eee14a96ff2d825a30072eb06e40 /src/main/java/org/openslx/satserver/util/Util.java
parentAdded class ProxyHandler for for configuring proxy settings system wide once ... (diff)
downloadtmlite-bwlp-ecb072b02e1a70555db0fdf4ed47375d3080a074.tar.gz
tmlite-bwlp-ecb072b02e1a70555db0fdf4ed47375d3080a074.tar.xz
tmlite-bwlp-ecb072b02e1a70555db0fdf4ed47375d3080a074.zip
Many improvements and additions:
- Added task+script for lighttpd https config - Added task for reloading proxy config - ldapsearch now supports searching for specific user - DownloadFile now supports checking file integrity through optional gpg signature
Diffstat (limited to 'src/main/java/org/openslx/satserver/util/Util.java')
-rw-r--r--src/main/java/org/openslx/satserver/util/Util.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/org/openslx/satserver/util/Util.java b/src/main/java/org/openslx/satserver/util/Util.java
index fe7eb6e..2df4c73 100644
--- a/src/main/java/org/openslx/satserver/util/Util.java
+++ b/src/main/java/org/openslx/satserver/util/Util.java
@@ -5,6 +5,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
@@ -30,6 +31,7 @@ public class Util
/**
* Close all given Closables. Can handle null references.
+ *
* @param streams one or more closables/streams
*/
public static void multiClose( Closeable... streams )
@@ -64,14 +66,15 @@ public class Util
}
return true;
}
-
- public static String readFileToString(String file)
+
+ public static String readFileToString( String file ) throws IOException
{
- try {
- return FileUtils.readFileToString( new File( file ) );
- } catch ( Exception e ) {
- return null;
- }
+ return FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
}
-
+
+ public static void writeStringToFile( File file, String string ) throws IOException
+ {
+ FileUtils.writeStringToFile( file, string, StandardCharsets.UTF_8 );
+ }
+
}