aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-11-01 18:50:11 +0100
committernea <nea@nea.moe>2023-11-01 18:50:11 +0100
commit297cb01f220a617dd08096467978b2fccbc27695 (patch)
treed467f358313ce3648063da41b66361a840fa7864 /src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java
parentd5253dc5c3ae7b2cc1fcb96780e43b929a449eb4 (diff)
downloadModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.tar.gz
ModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.tar.bz2
ModernJavaLauncher-297cb01f220a617dd08096467978b2fccbc27695.zip
Add documentation
Diffstat (limited to 'src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java')
-rw-r--r--src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java b/src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java
new file mode 100644
index 0000000..b7f82c0
--- /dev/null
+++ b/src/main/java/moe/nea/modernjava/launch/util/TextIoUtils.java
@@ -0,0 +1,22 @@
+package moe.nea.modernjava.launch.util;
+
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class TextIoUtils {
+ /**
+ * Flush out the standard IO, without closing it. Works even after {@link System#setOut(PrintStream)} or similar has been called
+ */
+ public static void flushStdIO() {
+ try {
+ // These streams should not be closed. We just want to flush them out
+ //noinspection resource
+ new FileOutputStream(FileDescriptor.out).flush();
+ //noinspection resource
+ new FileOutputStream(FileDescriptor.err).flush();
+ } catch (IOException ignored) {
+ }
+ }
+}