Example usage for java.io OutputStream close

List of usage examples for java.io OutputStream close

Introduction

In this page you can find the example usage for java.io OutputStream close.

Prototype

public void close() throws IOException 

Source Link

Document

Closes this output stream and releases any system resources associated with this stream.

Usage

From source file:Main.java

public static void close(OutputStream os) {
    try {/*from w  w w  . j a  va2s  . c o  m*/
        if (os != null) {
            os.close();
        }
    } catch (Exception e) {
        // TODO: handle exception
    }
}

From source file:Main.java

/**
 * close OutputStream//from w w w  .jav  a2s  .co m
 * @param out
 */
public static void closeOutputStream(OutputStream out) {
    if (out != null) {
        try {
            out.close();
            out = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void close(OutputStream out) {
    if (out != null) {
        try {/*from www.j  av  a 2  s  .  c o m*/
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void closeOutputStreamQuiet(OutputStream output) {
    if (output == null)
        return;//from w w w . j  a  v  a  2  s  .co m
    try {
        output.close();
    } catch (IOException e) {
    }
}

From source file:Main.java

public static void close(OutputStream stream) {
    if (stream != null) {
        try {/*from  w  w  w.j  av  a2  s.  co m*/
            stream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

private static void closeSilent(OutputStream outputStream) {
    if (outputStream != null) {
        try {//  w  w w  . j a  v a2 s .  co  m
            outputStream.close();
        } catch (IOException e) {
            // null
        }
    }
}

From source file:Main.java

private static void closeOutputStream(OutputStream outputStream) {
    try {/*from  w w w. ja  v a2  s . c o  m*/
        if (outputStream != null) {
            outputStream.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void spitFile(String outputfile, byte[] b) throws IOException {
    OutputStream os = context.openFileOutput(outputfile, Context.MODE_PRIVATE);
    os.write(b);/*from w w  w  .jav  a 2s. co  m*/
    os.close();
}

From source file:Main.java

private static void closeStream(final OutputStream stream) {
    if (stream == null)
        return;/*ww w.  java 2  s  . com*/
    try {
        stream.close();
    } catch (final IOException ignored) {
    }
}

From source file:Main.java

/**
 * Close a ByteArrayOutputStream passed in.
 *
 * @param stream - ByteArrayOutputStream to be closed.
 */// w  w  w.  j ava 2s.c  om
public static void closeOutputStream(OutputStream stream, String tag) {
    if (stream != null) {
        try {
            stream.close();
        } catch (IOException e) {
            Log.e(tag, "Exception occured when closing ByteArrayOutputStream." + e);
        }
    }
}