List of utility methods to do Dump Stream
void | dumpStreamToFile(InputStream is, String filename) Dump the input stream to the specified file. FileOutputStream fos = null; try { fos = new FileOutputStream(filename); dumpStreamToStream(is, fos); } catch (Exception ex) { ex.printStackTrace(); } finally { close(fos); ... |
void | dumpStreamToStream(InputStream is, OutputStream os) Dump the input stream to the output stream. byte ba[] = new byte[2048]; int numRead = 0; try { numRead = is.read(ba); while (numRead > 0) { os.write(ba, 0, numRead); numRead = is.read(ba); } catch (Exception ex) { ex.printStackTrace(); } finally { if (os != null) try { os.flush(); } catch (Exception ex) { ; |
void | dumpThreads(PrintStream ps) dump Threads int active = Thread.activeCount(); Thread threads[] = new Thread[active]; Thread.enumerate(threads); for (int i = 0; i < active; i++) { ps.println(i + ": " + threads[i]); |
void | dumpToFile(Object obj, OutputStream os) dump To File ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(os); oos.writeObject(obj); oos.close(); } catch (IOException e) { e.printStackTrace(); |