List of utility methods to do Dump Stream
void | dumpInputOutputStream(InputStream is, OutputStream os) Dumps all bytes from an input stream to the given output stream. if (is == null) { return; int ch; while ((ch = is.read()) != -1) { os.write(ch); |
byte[] | dumpInputStream(InputStream instream) dump an InputStream, returning a newly created byte[] array int lastindex = 0; int increment; byte[] A = new byte[2048]; byte[] B; do { B = new byte[2 * A.length]; System.arraycopy(A, 0, B, 0, A.length); A = B; ... |
void | dumpInputStream(InputStream is, PrintStream p) dump Input Stream char[] chars = new char[1024]; InputStreamReader reader = new InputStreamReader(is); while (reader.ready()) { int l = reader.read(chars); if (l == chars.length) { p.print(chars); continue; for (int i = 0; i < l; i++) { p.print(chars[i]); |
void | dumpInputStream(InputStream stream) dump Input Stream BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream)); String line; try { while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } catch (IOException e) { e.printStackTrace(); ... |
void | dumpInputStreamAsString(InputStream is) dump Input Stream As String BufferedReader br = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { sb.append(line); System.out.println(sb.toString()); |
String | dumpInputStreamIntoString(InputStream f, String encoding) dump Input Stream Into String ByteArrayOutputStream byteStream = null; BufferedInputStream fileStream = null; byteStream = new ByteArrayOutputStream(); fileStream = new BufferedInputStream((f)); int data = -1; while ((data = fileStream.read()) != -1) { byteStream.write(data); byte[] raw = byteStream.toByteArray(); return new String(raw, encoding); |
void | dumpMap(PrintStream out, Map Values) print a string listing what is in a Map Works best of all entried are string or have good toString methods out.println(describeMap(Values)); |
InputStream | dumpStream(InputStream in, PrintStream dump, boolean closeIn) dump Stream ByteArrayOutputStream out = new ByteArrayOutputStream(); try { transfer(in, out, closeIn); dump.println("-- stream dump start --"); dump.println(out.toString()); dump.println("-- stream dump end --"); } catch (Throwable t) { throw new IOException(t); ... |
void | dumpStream(InputStream in, String file) Dump stream to file try { File f = new File(file); OutputStream os = new FileOutputStream(f); int ch; while ((ch = in.read()) >= 0) os.write(ch); os.flush(); os.close(); ... |
InputStream | dumpStreamAndReOffer(InputStream is) dump Stream And Re Offer FileOutputStream fos = null; try { ByteArrayOutputStream os = new ByteArrayOutputStream(); copyStream(is, os); byte[] data = os.toByteArray(); fos = new FileOutputStream(File.createTempFile("dump", ".bin", new File("."))); fos.write(data); return new ByteArrayInputStream(data); ... |