Java Stream Close closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists)

Here you can find the source of closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists)

Description

Close input.

License

Open Source License

Parameter

Parameter Description
sourceInput stream to close
suppressionSourceExists previous state of flag

Return

result of close operation

Declaration

private static boolean closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists) 

Method Source Code


//package com.java2s;
// License as published by the Free Software Foundation; either

import java.io.IOException;
import java.io.InputStream;

public class Main {
    /**//from   ww w.  j  a v  a2 s .c o  m
     * Close input.
     * This method is required till https://github.com/cobertura/cobertura/issues/170
     * @param sourceInput stream to close
     * @param suppressionSourceExists previous state of flag
     * @return result of close operation
     */
    private static boolean closeQuietlyWithResult(InputStream sourceInput, boolean suppressionSourceExists) {
        boolean closed = suppressionSourceExists;
        if (sourceInput != null) {
            try {
                sourceInput.close();
            } catch (IOException ignored) {
                closed = false;
            }
        }
        return closed;
    }
}

Related

  1. closeQuietly(Reader input)
  2. closeQuietly(Reader r)
  3. closeQuietly(Reader reader)
  4. closeQuietly(Writer writer)
  5. closeQuietly(ZipFile closeable)
  6. closeRandomAccessFile()
  7. closeReader(BufferedReader reader)
  8. closeReader(final Reader reader)
  9. closeReader(Reader r)