aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
index 64f46314..729bdf11 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/StreamUtil.java
@@ -6,6 +6,7 @@ import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.Socket;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
@@ -40,6 +41,20 @@ public final class StreamUtil {
}
/**
+ * Closes a socket.
+ * IOException is silently ignored.
+ * @param socket the socket to close
+ */
+ public static void close(Socket socket) {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ /**
* Avoid instantiation of util class.
*/
private StreamUtil() {