Java Dump Byte Array dump(byte[] data, OutputStream out, boolean closeOutput)

Here you can find the source of dump(byte[] data, OutputStream out, boolean closeOutput)

Description

Dump all data in buffer to output stream.

License

Open Source License

Parameter

Parameter Description
data a parameter
out a parameter
closeOutput a parameter

Exception

Parameter Description
IOException an exception

Declaration

public static void dump(byte[] data, OutputStream out, boolean closeOutput) throws IOException 

Method Source Code

//package com.java2s;

import java.io.IOException;

import java.io.OutputStream;

public class Main {
    /**/* w w  w . j a va  2  s . c o m*/
     * Dump all data in buffer to output stream. Optionally close output stream
     * when all data has been written.
     *
     * @param data
     * @param out
     * @param closeOutput
     * @throws IOException
     */
    public static void dump(byte[] data, OutputStream out, boolean closeOutput) throws IOException {
        try {
            out.write(data, 0, data.length);
        } finally {
            if (closeOutput) {
                out.close();
            }
        }
    }
}

Related

  1. dump(byte[] buffer, int start, int size, PrintStream out)
  2. dump(final byte[] b, final PrintStream out)
  3. dump(PrintStream printer, byte[] buffer, int offset, int count)
  4. dumpBuffer(final PrintStream out, final String label, final byte[] b)
  5. dumpByteArray(byte[] byteArray)