Java Stream Close closeAll()

Here you can find the source of closeAll()

Description

close All

License

Open Source License

Declaration

public static void closeAll() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.PrintStream;

public class Main {
    /**// w  w  w .j  a va2 s .c  o  m
     * If non-null, copy all printing to this stream as well.
     */
    // TODO NEED TO CLEAN UP DRIBBLE STREAM!
    private static PrintStream dribbleStream = null;
    private static PrintStream dribbleStream2 = null;
    private static PrintStream debugStream = null;
    private static PrintStream warningStream = null;
    /**
     * Creates a dribble file with the given name in the current working
     * directory.
     * 
     * @param fileName
     *            The name of the dribble file.
     */
    public static String dribbleFileName = null;
    public static String dribbleFileName2 = null;
    public static String debugFileName = null;
    public static String warningFileName = null;

    public static void closeAll() {
        closeDribbleFile();
        closeDribbleFile2();
        closeDebugFile();
        closeWarningFile();
    }

    public static void closeDribbleFile() {
        dribbleFileName = null;
        if (dribbleStream == null) {
            return;
        }
        dribbleStream.close();
        dribbleStream = null;
    }

    public static void closeDribbleFile2() {
        dribbleFileName2 = null;
        if (dribbleStream2 == null) {
            return;
        }
        dribbleStream2.close();
        dribbleStream2 = null;
    }

    public static void closeDebugFile() {
        debugFileName = null;
        if (debugStream == null) {
            return;
        }
        debugStream.close();
        debugStream = null;
    }

    public static void closeWarningFile() {
        warningFileName = null;
        if (warningStream == null) {
            return;
        }
        warningStream.close();
        warningStream = null;
    }
}

Related

  1. close(Writer stream)
  2. close(ZipFile file)
  3. close(ZipFile file)
  4. close(ZipFile file)
  5. close(ZipFile zipFile)
  6. closeAll()
  7. closeAll(Collection closeables)
  8. closeAll(Exception firstEx, Closeable... objects)
  9. closeAll(Iterable closeables)