org.apache.logging.log4j.core.util
Class Closer

java.lang.Object
  extended by org.apache.logging.log4j.core.util.Closer

public final class Closer
extends Object

Helper class for closing resources.


Method Summary
static void close(Closeable closeable)
          Closes the specified Closeable (stream or reader/writer).
static void close(Connection connection)
          Closes the specified Connection.
static void close(Context context)
          Closes the specified Context.
static void close(DatagramSocket datagramSocket)
          Closes the specified resource.
static void close(ServerSocket serverSocket)
          Closes the specified resource.
static void close(Statement statement)
          Closes the specified Statement.
static void closeSilent(Closeable closeable)
          Closes the specified Closeable (stream or reader/writer), ignoring any exceptions thrown by the close operation.
static void closeSilent(Connection connection)
          Closes the specified Connection, ignoring any exceptions thrown by the close operation.
static void closeSilent(Context context)
          Closes the specified Context, ignoring any exceptions thrown by the close operation.
static void closeSilent(DatagramSocket datagramSocket)
          Closes the specified resource, ignoring any exceptions thrown by the close operation.
static void closeSilent(ServerSocket serverSocket)
          Closes the specified resource, ignoring any exceptions thrown by the close operation.
static void closeSilent(Statement statement)
          Closes the specified Statement, ignoring any exceptions thrown by the close operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

closeSilent

public static void closeSilent(Closeable closeable)
Closes the specified Closeable (stream or reader/writer), ignoring any exceptions thrown by the close operation.

Parameters:
closeable - the resource to close, may be null

close

public static void close(Closeable closeable)
                  throws IOException
Closes the specified Closeable (stream or reader/writer).

Parameters:
closeable - the resource to close, may be null
Throws:
IOException - if a problem occurred closing the specified resource

closeSilent

public static void closeSilent(ServerSocket serverSocket)
Closes the specified resource, ignoring any exceptions thrown by the close operation.

Parameters:
serverSocket - the resource to close, may be null

close

public static void close(ServerSocket serverSocket)
                  throws IOException
Closes the specified resource.

Parameters:
serverSocket - the resource to close, may be null
Throws:
IOException - if a problem occurred closing the specified resource

closeSilent

public static void closeSilent(DatagramSocket datagramSocket)
Closes the specified resource, ignoring any exceptions thrown by the close operation.

Parameters:
datagramSocket - the resource to close, may be null

close

public static void close(DatagramSocket datagramSocket)
                  throws IOException
Closes the specified resource.

Parameters:
datagramSocket - the resource to close, may be null
Throws:
IOException - if a problem occurred closing the specified resource

closeSilent

public static void closeSilent(Statement statement)
Closes the specified Statement, ignoring any exceptions thrown by the close operation.

Parameters:
statement - the resource to close, may be null

close

public static void close(Statement statement)
                  throws SQLException
Closes the specified Statement.

Parameters:
statement - the resource to close, may be null
Throws:
SQLException - if a problem occurred closing the specified resource

closeSilent

public static void closeSilent(Connection connection)
Closes the specified Connection, ignoring any exceptions thrown by the close operation.

Parameters:
connection - the resource to close, may be null

close

public static void close(Connection connection)
                  throws SQLException
Closes the specified Connection.

Parameters:
connection - the resource to close, may be null
Throws:
SQLException - if a problem occurred closing the specified resource

closeSilent

public static void closeSilent(Context context)
Closes the specified Context, ignoring any exceptions thrown by the close operation.

Parameters:
context - the JNDI Context to close, may be null

close

public static void close(Context context)
                  throws NamingException
Closes the specified Context.

Parameters:
context - the JNDI Context to close, may be null
Throws:
NamingException - if a problem occurred closing the specified JNDI Context


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.