java重定向System Output,java重定向output,Java// Unix
分享于 点击 31390 次 点评:98
java重定向System Output,java重定向output,Java// Unix
Java
// Unix stylePrintStream nps = new PrintStream(new FileOutputStream("/dev/null"));System.setErr(nps);System.setOut(nps);//Windows stylePrintStream nps = new PrintStream(new FileOutputStream("NUL:"));System.setErr(nps);System.setOut(nps);//One-liner style : subclass OutputStream to override the write method ...System.setOut(new java.io.PrintStream(new java.io.OutputStream() { public void write(int b){}}));
用户点评