diff options
author | Simon Rettberg | 2014-11-18 18:40:49 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-11-18 18:40:49 +0100 |
commit | ecb072b02e1a70555db0fdf4ed47375d3080a074 (patch) | |
tree | 75db05621458eee14a96ff2d825a30072eb06e40 /src/main/java/org/openslx/satserver/util/Util.java | |
parent | Added class ProxyHandler for for configuring proxy settings system wide once ... (diff) | |
download | tmlite-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.java | 19 |
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 ); + } + } |