Back to project page HelloWebView.
The source code is released under:
Apache License
If you think the Android project HelloWebView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mengdd.hellowebview.utils; /*from ww w . j a v a 2s .c o m*/ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class IOUtils { /** * read bytes array from input stream * * @param is * @return */ public static byte[] readStream(InputStream is) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { byte[] buffer = new byte[2048]; int len = 0; while ((len = is.read(buffer)) != -1) { os.write(buffer, 0, len); } os.flush(); return os.toByteArray(); } catch (Exception e) { e.printStackTrace(); } finally { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } return null; } }