summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/IndentStream.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/IndentStream.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/IndentStream.java')
-rw-r--r--NET/worlds/scape/IndentStream.java138
1 files changed, 138 insertions, 0 deletions
diff --git a/NET/worlds/scape/IndentStream.java b/NET/worlds/scape/IndentStream.java
new file mode 100644
index 0000000..2795c91
--- /dev/null
+++ b/NET/worlds/scape/IndentStream.java
@@ -0,0 +1,138 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.io.OutputStream;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class IndentStream
+/* */ extends PrintStream
+/* */ {
+/* 19 */ private boolean _atstart = true;
+/* 20 */ private int _indent = 0;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public IndentStream(OutputStream os)
+/* */ {
+/* 28 */ super(os);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public IndentStream(OutputStream os, boolean flush)
+/* */ {
+/* 39 */ super(os, flush);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void indent(int step)
+/* */ {
+/* 48 */ this._indent += step;
+/* */ }
+/* */
+/* */
+/* */ public void indent()
+/* */ {
+/* 54 */ indent(2);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void undent(int step)
+/* */ {
+/* 64 */ if (this._indent >= step) {
+/* 65 */ this._indent -= step;
+/* */ } else {
+/* 67 */ this._indent = 0;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* 73 */ public void undent() { undent(2); }
+/* */
+/* 75 */ public int curIndent() { return this._indent; }
+/* */
+/* */
+/* */
+/* */
+/* */ private void startLine()
+/* */ {
+/* 82 */ for (int i = 0; i < this._indent; i++)
+/* 83 */ super.write(32);
+/* 84 */ this._atstart = false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void write(int b)
+/* */ {
+/* 92 */ if (b == 10) {
+/* 93 */ this._atstart = true;
+/* */ }
+/* 95 */ else if (this._atstart)
+/* 96 */ startLine();
+/* 97 */ super.write(b);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void write(byte[] b, int off, int len)
+/* */ {
+/* 105 */ while (len > 0) {
+/* 106 */ int firstlen = 0;
+/* */
+/* 108 */ while ((firstlen < len) && (b[(off + firstlen)] != 10)) {
+/* 109 */ firstlen++;
+/* */ }
+/* 111 */ if (firstlen > 0) {
+/* 112 */ if (this._atstart)
+/* 113 */ startLine();
+/* 114 */ super.write(b, off, firstlen);
+/* 115 */ off += firstlen;
+/* 116 */ len -= firstlen;
+/* 117 */ this._atstart = false;
+/* 118 */ firstlen = 0;
+/* */ }
+/* */
+/* 121 */ while ((firstlen < len) && (b[(off + firstlen)] == 10)) {
+/* 122 */ firstlen++;
+/* */ }
+/* 124 */ if (firstlen > 0) {
+/* 125 */ super.write(b, off, firstlen);
+/* 126 */ off += firstlen;
+/* 127 */ len -= firstlen;
+/* 128 */ this._atstart = true;
+/* */ }
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\IndentStream.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file