Java Stream Close close(final Scanner scanner)

Here you can find the source of close(final Scanner scanner)

Description

close

License

Apache License

Declaration

public static void close(final Scanner scanner) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.Closeable;

import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void close(final Scanner scanner) {
        if (scanner != null) {
            scanner.close();/*from   w  w w .  java 2s  .  c  o  m*/
        }
    }

    public static IOException close(final Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (final IOException e) {
                e.printStackTrace();
                return e;
            }
        }
        return null;
    }
}

Related

  1. close(final InputStream stream)
  2. close(final InputStream stream)
  3. close(final Logger logger, final Closeable... closeables)
  4. close(final Object stream)
  5. close(final OutputStream dest)
  6. close(Iterator iterator)
  7. close(java.io.Closeable in)
  8. close(JMXConnector connector)
  9. close(Object obj)