X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fstreams%2FStreamUtils.java;fp=src%2Fbe%2Fnikiroo%2Futils%2Fstreams%2FStreamUtils.java;h=dc75090858fb56f36ecc808eb48a9819056871d5;hb=f8147a0ee57317e96d9ff0bf19573f7168d0354c;hp=9b9ffe653c8d7823dbfdc9f279b950711a51e066;hpb=7194ac50b29064a013f177fc9cfc5aaa131a8ec4;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/streams/StreamUtils.java b/src/be/nikiroo/utils/streams/StreamUtils.java index 9b9ffe6..dc75090 100644 --- a/src/be/nikiroo/utils/streams/StreamUtils.java +++ b/src/be/nikiroo/utils/streams/StreamUtils.java @@ -1,6 +1,6 @@ package be.nikiroo.utils.streams; -import java.io.UnsupportedEncodingException; +import be.nikiroo.utils.StringUtils; /** * Some non-public utilities used in the stream classes. @@ -50,24 +50,6 @@ class StreamUtils { return same; } - /** - * Return the bytes array representation of the given {@link String} in - * UTF-8. - * - * @param str - * the {@link String} to transform into bytes - * @return the content in bytes - */ - static public byte[] bytes(String str) { - try { - return str.getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - // All conforming JVM must support UTF-8 - e.printStackTrace(); - return null; - } - } - /** * Return the bytes array representation of the given {@link String} in * UTF-8. @@ -76,17 +58,12 @@ class StreamUtils { * the {@link String}s to transform into bytes * @return the content in bytes */ - static public byte[][] bytes(String[] strs) { - try { - byte[][] bytes = new byte[strs.length][]; - for (int i = 0; i < strs.length; i++) { - bytes[i] = strs[i].getBytes("UTF-8"); - } - return bytes; - } catch (UnsupportedEncodingException e) { - // All conforming JVM must support UTF-8 - e.printStackTrace(); - return null; + static public byte[][] getBytes(String[] strs) { + byte[][] bytes = new byte[strs.length][]; + for (int i = 0; i < strs.length; i++) { + bytes[i] = StringUtils.getBytes(strs[i]); } + + return bytes; } }