summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satserver/util/Util.java
diff options
context:
space:
mode:
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 );
+ }
+
}