com.github.bingoohuang.blackcat.instrument.spring.TeePrintWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blackcat-instrument Show documentation
Show all versions of blackcat-instrument Show documentation
agent that monitor a machine's memory, cpu, processes and etc.
The newest version!
package com.github.bingoohuang.blackcat.instrument.spring;
import java.io.PrintWriter;
public class TeePrintWriter extends PrintWriter {
PrintWriter branch;
public TeePrintWriter(PrintWriter main, PrintWriter branch) {
super(main, true);
this.branch = branch;
}
public void write(char buf[], int off, int len) {
super.write(buf, off, len);
super.flush();
branch.write(buf, off, len);
branch.flush();
}
public void write(String s, int off, int len) {
super.write(s, off, len);
super.flush();
branch.write(s, off, len);
branch.flush();
}
public void write(int c) {
super.write(c);
super.flush();
branch.write(c);
branch.flush();
}
public void flush() {
super.flush();
branch.flush();
}
}