Mercurial Hosting > luan
diff src/luan/modules/Utils.java @ 1493:471ef3e6a84e
more io
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 03 May 2020 00:12:15 -0600 |
parents | 225808b90cee |
children | 0ba144491a42 |
line wrap: on
line diff
--- a/src/luan/modules/Utils.java Sat May 02 22:25:56 2020 -0600 +++ b/src/luan/modules/Utils.java Sun May 03 00:12:15 2020 -0600 @@ -10,6 +10,7 @@ import java.net.URL; import java.net.MalformedURLException; import java.util.Map; +import goodjava.io.IoUtils; import luan.Luan; import luan.LuanException; import luan.LuanTable; @@ -78,21 +79,11 @@ return buf.toString(); } - public static void copyAll(InputStream in,OutputStream out) - throws IOException - { - byte[] a = new byte[bufSize]; - int n; - while( (n=in.read(a)) != -1 ) { - out.write(a,0,n); - } - } - public static byte[] readAll(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); - copyAll(in,out); + IoUtils.copyAll(in,out); return out.toByteArray(); }