diff options
author | Jiri Vanek <[email protected]> | 2013-07-18 08:53:46 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-07-18 08:53:46 +0200 |
commit | 3650eabff054cd3c6b3670d248ffeb04e0b76478 (patch) | |
tree | 47d498921c29cd34a48026ac5c4a1b17b27aa3cd /tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java | |
parent | 0fe719f17d81f95491b939f23b5d5c3111f7c427 (diff) |
IcedTea-Web is now following XDG .config and .cache specification(RH947647)
Diffstat (limited to 'tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java')
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java index 7d3b3d7..e9f4238 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -60,6 +60,7 @@ import net.sourceforge.jnlp.browsertesting.BrowserFactory; import net.sourceforge.jnlp.browsertesting.Browsers; import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener; import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener; +import net.sourceforge.jnlp.util.FileUtils; import org.junit.Assert; /** @@ -417,23 +418,8 @@ public class ServerAccess { * @return stream as string * @throws IOException if connection can't be established or resource does not exist */ - public static String getContentOfStream(InputStream is,String encoding) throws IOException { - try { - BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); - StringBuilder sb = new StringBuilder(); - while (true) { - String s = br.readLine(); - if (s == null) { - break; - } - sb.append(s).append("\n"); - - } - return sb.toString(); - } finally { - is.close(); - } - + public static String getContentOfStream(InputStream is, String encoding) throws IOException { + return FileUtils.getContentOfStream(is, encoding); } /** @@ -444,8 +430,7 @@ public class ServerAccess { * @throws IOException if connection can't be established or resource does not exist */ public static String getContentOfStream(InputStream is) throws IOException { - return getContentOfStream(is, "UTF-8"); - + return FileUtils.getContentOfStream(is); } /** @@ -491,13 +476,10 @@ public class ServerAccess { * @throws IOException */ public static void saveFile(String content, File f) throws IOException { - saveFile(content, f, "utf-8"); + FileUtils.saveFile(content, f); } public static void saveFile(String content, File f,String encoding) throws IOException { - Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding)); - output.write(content); - output.flush(); - output.close(); + FileUtils.saveFile(content, f, encoding); } /** |