Java Utililty Methods Stream Close

List of utility methods to do Stream Close

Description

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

Method

OutputStreamclose(OutputStream s)
Call close on an output stream and ignore any exception.
if (s != null) {
    try {
        s.close();
    } catch (IOException ioe) {
return null;
voidclose(PrintStream writer)
Closes a server.xml and writes the closing server element.
writer.println("</server>");
writer.close();
voidclose(Process process)
close
try {
    process.waitFor();
} catch (InterruptedException ie) {
    ie.printStackTrace();
try {
    process.getInputStream().close();
} catch (IOException ioe) {
...
voidclose(RandomAccessFile randomAccessFile)
close
if (randomAccessFile != null) {
    try {
        randomAccessFile.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
voidclose(Writer out)
close
try {
    out.close();
} catch (IOException e) {
Stringclose(Writer stream)
Close stream with the usual checks.
String result = null;
if (null != stream) {
    try {
        stream.close();
    } catch (IOException e) {
        result = e.getMessage();
return result;
voidclose(ZipFile file)
close
if (file == null)
    return;
try {
    file.close();
} catch (IOException e) {
voidclose(ZipFile file)
Unconditionally close a ZipFile.
if (file != null) {
    try {
        file.close();
    } catch (IOException ignore) {
voidclose(ZipFile file)
A special version of close() for ZipFiles, which don't implement Closeable.
if (file != null)
    file.close();
voidclose(ZipFile zipFile)
Closes zip file safely.
if (zipFile != null) {
    try {
        zipFile.close();
    } catch (IOException ioex) {