Hiding System.out.print calls of a class

前端 未结 5 1409
别那么骄傲
别那么骄傲 2021-02-02 13:16

I\'m using a java library (jar file). The author of the file put in a bunch of System.out.print and System.out.printlns. Is there any way to hide these

5条回答
  •  温柔的废话
    2021-02-02 13:33

    System.setOut(); is probably what you're looking for

    System.setOut(new PrintStream(new OutputStream() {
      public void write(int b) {
        // NO-OP
      }
    }));
    

    Source

提交回复
热议问题