141 lines
4.3 KiB
Java
141 lines
4.3 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.tridium.sys.stdout;
|
|
|
|
import com.tridium.encode.HtmlEncoder;
|
|
import java.io.PrintStream;
|
|
import javax.baja.spy.Spy;
|
|
import javax.baja.spy.SpyWriter;
|
|
import javax.baja.sys.Clock;
|
|
import javax.baja.sys.Sys;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class StdoutManager
|
|
extends PrintStream {
|
|
public int x;
|
|
public final PrintStream out;
|
|
private byte[] buffer;
|
|
private int pos;
|
|
|
|
public final void flush() {
|
|
this.out.flush();
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void write(int n) {
|
|
this.out.write(n);
|
|
byte[] byArray = this.buffer;
|
|
synchronized (this.buffer) {
|
|
this.buffer[this.pos] = (byte)(n & 0xFF);
|
|
this.pos = (this.pos + 1) % this.buffer.length;
|
|
// ** MonitorExit[var2_2] (shouldn't be in output)
|
|
return;
|
|
}
|
|
}
|
|
|
|
public final void write(byte[] byArray) {
|
|
this.write(byArray, 0, byArray.length);
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public final void write(byte[] byArray, int n, int n2) {
|
|
this.out.write(byArray, n, n2);
|
|
byte[] byArray2 = this.buffer;
|
|
synchronized (this.buffer) {
|
|
block5: {
|
|
int n3;
|
|
block4: {
|
|
if (n2 > this.buffer.length) {
|
|
n += n2 - this.buffer.length;
|
|
n2 = this.buffer.length;
|
|
}
|
|
if ((n3 = Math.min(n2, this.buffer.length - this.pos)) != n2) break block4;
|
|
System.arraycopy(byArray, n, this.buffer, this.pos, n3);
|
|
this.pos = (this.pos + n2) % this.buffer.length;
|
|
break block5;
|
|
}
|
|
int n4 = n2 - n3;
|
|
System.arraycopy(byArray, n, this.buffer, this.pos, n3);
|
|
System.arraycopy(byArray, n + n3, this.buffer, 0, n4);
|
|
this.pos = n4;
|
|
}
|
|
// ** MonitorExit[var4_4] (shouldn't be in output)
|
|
return;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* WARNING - Removed try catching itself - possible behaviour change.
|
|
* Enabled aggressive block sorting
|
|
* Enabled unnecessary exception pruning
|
|
* Enabled aggressive exception aggregation
|
|
*/
|
|
public byte[] getBuffer() {
|
|
byte[] byArray = this.buffer;
|
|
synchronized (this.buffer) {
|
|
byte[] byArray2 = new byte[this.buffer.length];
|
|
System.arraycopy(this.buffer, this.pos, byArray2, 0, this.buffer.length - this.pos);
|
|
System.arraycopy(this.buffer, 0, byArray2, this.buffer.length - this.pos, this.pos);
|
|
// ** MonitorExit[var1_1] (shouldn't be in output)
|
|
return byArray2;
|
|
}
|
|
}
|
|
|
|
public void postInit() {
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.x = 10;
|
|
this.buffer = new byte[8192];
|
|
this.pos = 0;
|
|
}
|
|
|
|
public StdoutManager() {
|
|
super(System.out);
|
|
this.this();
|
|
this.out = System.out;
|
|
System.setOut(this);
|
|
}
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class SpyPage
|
|
extends Spy {
|
|
public void write(SpyWriter spyWriter) throws Exception {
|
|
if (Sys.getStation() != null) {
|
|
spyWriter.w("<b>Station</b> ").w(Sys.getStation().getStationName()).w(" | ");
|
|
}
|
|
spyWriter.w("<b>Time</b> ").w(Clock.time());
|
|
spyWriter.w("<hr>\n");
|
|
spyWriter.w("<pre>\n");
|
|
byte[] byArray = StdoutManager.this.getBuffer();
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
int n = 0;
|
|
while (n < byArray.length) {
|
|
byte by = byArray[n];
|
|
if (by != 0) {
|
|
stringBuffer.append((char)by);
|
|
}
|
|
++n;
|
|
}
|
|
spyWriter.w(HtmlEncoder.encode(stringBuffer.toString()));
|
|
spyWriter.w("</pre>\n");
|
|
}
|
|
}
|
|
}
|
|
|