package org.apache.logging.log4j.core.util;

import java.io.Closeable;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public final class Closer {
   private Closer() {
   }

   public static void closeSilently(Closeable closeable) {
      try {
         close(closeable);
      } catch (Exception var2) {
      }

   }

   public static void close(Closeable closeable) throws IOException {
      if (closeable != null) {
         closeable.close();
      }

   }

   public static void closeSilently(ServerSocket serverSocket) {
      try {
         close(serverSocket);
      } catch (Exception var2) {
      }

   }

   public static void close(ServerSocket serverSocket) throws IOException {
      if (serverSocket != null) {
         serverSocket.close();
      }

   }

   public static void closeSilently(DatagramSocket datagramSocket) {
      try {
         close(datagramSocket);
      } catch (Exception var2) {
      }

   }

   public static void close(DatagramSocket datagramSocket) throws IOException {
      if (datagramSocket != null) {
         datagramSocket.close();
      }

   }

   public static void closeSilently(Statement statement) {
      try {
         close(statement);
      } catch (Exception var2) {
      }

   }

   public static void close(Statement statement) throws SQLException {
      if (statement != null) {
         statement.close();
      }

   }

   public static void closeSilently(Connection connection) {
      try {
         close(connection);
      } catch (Exception var2) {
      }

   }

   public static void close(Connection connection) throws SQLException {
      if (connection != null) {
         connection.close();
      }

   }
}
