List of usage examples for org.apache.wicket.util.io ByteArrayOutputStream write
@Override public synchronized void write(final byte[] b, final int off, final int len)
From source file:com.gitblit.servlet.PtServlet.java
License:Apache License
byte[] readAll(InputStream is) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try {// ww w. j a va 2 s . c o m byte[] buffer = new byte[4096]; int len = 0; while ((len = is.read(buffer)) > -1) { os.write(buffer, 0, len); } return os.toByteArray(); } catch (IOException e) { e.printStackTrace(); } finally { try { os.close(); is.close(); } catch (Exception e) { // ignore } } return new byte[0]; }