Hooking an existing method in Java

前端 未结 5 1442
清歌不尽
清歌不尽 2021-02-19 14:08

I want to hook the method System.out.print in Java and have the ability to read/change the variables used in the method before the part of the method is called that actually add

5条回答
  •  遥遥无期
    2021-02-19 14:42

    Since JDK 1.1, the System.setOut and System.setErr methods are added to enable applications to hook the streams.

    Link : http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#setOut(java.io.PrintStream)

    http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#setErr(java.io.PrintStream)

提交回复
热议问题