Java Utililty Methods Dump Stream

List of utility methods to do Dump Stream

Description

The list of methods to do Dump Stream are organized into topic(s).

Method

voiddump(final InputStream input)
Dump output coming from the stream
final int streamBufferSize = 1000;
new Thread(new Runnable() {
    public void run() {
        try {
            byte[] b = new byte[streamBufferSize];
            while ((input.read(b)) != -1) {
        } catch (IOException e) {
...
longdump(InputStream inputStream, OutputStream out)
dump
long total = 0;
int read;
int bufferSize = 8192;
byte[] buffer = new byte[bufferSize];
while ((read = inputStream.read(buffer, 0, bufferSize)) > -1) {
    out.write(buffer, 0, read);
    total += read;
out.flush();
return total;
voiddump(InputStream is, File to)
dump the stream given to the given file
FileOutputStream fos = new FileOutputStream(to);
byte[] r = new byte[1024];
int size;
while ((size = is.read(r)) > 0) {
    fos.write(r, 0, size);
fos.close();
voiddump(PrintStream p, String indent, String s)
dump
try {
    boolean expanded = s.length() > 60;
    if (needsCDATA(s)) {
        if (expanded) {
            p.println("<![CDATA[");
            p.println(s);
            p.println("]]>");
        } else {
...
voiddumparr(Object[] arr, PrintStream out, boolean term)
dumparr
out.print('[');
boolean f = true;
for (Object o : arr) {
    if (!f)
        out.print(", ");
    f = false;
    if (o instanceof Object[])
        dumparr((Object[]) o, out, false);
...
voiddumpArray(PrintStream out, Object[] array)
dump Array
out.print("{ ");
for (int i = 0; i < array.length; i++) {
    out.print(array[i].toString());
    if (i != (array.length - 1)) {
        out.print(", ");
out.print(" }");
...
voiddumpEvent(String event, OutputStream stream)
dump an array of bytes to an OutputStream
stream.write(event.getBytes());
stream.write(EOL.getBytes());
voiddumpFile(InputStream file, String header, String testName)
dump File
dumpFile(System.out, file, header, testName);
voiddumpFile(JarInputStream jin, File targetFile)
Reads an entry from a JarInputStream and stores it in the given targetFile.
OutputStream out = new FileOutputStream(targetFile);
byte[] buffer = new byte[1024];
int len = 0;
while ((len = jin.read(buffer, 0, buffer.length)) != -1) {
    out.write(buffer, 0, len);
out.flush();
out.close();
...
booleandumpFile(String r_file, OutputStream outputstream)
dump File
byte abyte0[] = new byte[4096];
boolean flag = true;
FileInputStream fiStream = null;
try {
    fiStream = new FileInputStream(r_file);
    int i;
    while ((i = fiStream.read(abyte0)) != -1)
        outputstream.write(abyte0, 0, i);
...