summaryrefslogtreecommitdiff
path: root/base/src
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2018-09-06 15:45:25 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2018-09-06 15:45:25 -0300
commitd1f095551f9a602977e6fa80e91a738192c5d08c (patch)
treee5009a1be77cad734ea54ee64e2ba75b4ed3eeb7 /base/src
parent6f1f3667182e8aba42bb102c071f4631ed042eed (diff)
Fix stupid bug
Diffstat (limited to 'base/src')
-rw-r--r--base/src/main/java/bjc/utils/ioutils/ReportWriter.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/base/src/main/java/bjc/utils/ioutils/ReportWriter.java b/base/src/main/java/bjc/utils/ioutils/ReportWriter.java
index 704ec10..f083509 100644
--- a/base/src/main/java/bjc/utils/ioutils/ReportWriter.java
+++ b/base/src/main/java/bjc/utils/ioutils/ReportWriter.java
@@ -57,6 +57,10 @@ public class ReportWriter extends Writer {
return lastChar;
}
+ public Writer getWriter() {
+ return contained;
+ }
+
public boolean isLastCharNL() {
return lastCharWasNL;
}
@@ -144,6 +148,14 @@ public class ReportWriter extends Writer {
dedent(1);
}
+ public void writeBuffer(StringBuffer sb) throws IOException {
+ write(sb.toString());
+
+ // Clear the buffer
+ sb.delete(0, sb.length());
+ }
+
+ @Override
public void write(char[] cbuf, int off, int len) throws IOException {
String actIndentStr = printTabsAsSpaces ? indentStrSpacedTabs : indentStr;
@@ -164,7 +176,7 @@ public class ReportWriter extends Writer {
for(int i = 0; i < len; i++) {
int idx = i + off;
- char c = cbuf[off];
+ char c = cbuf[idx];
if(c == '\n' || c == '\r') {
// Count lines written
@@ -207,11 +219,23 @@ public class ReportWriter extends Writer {
}
}
+ @Override
public void flush() throws IOException {
contained.flush();
}
+ @Override
public void close() throws IOException {
contained.close();
}
+
+ // @NOTE 9/5/18
+ //
+ // There are some cases where I can imagine that you might want our
+ // extra info, but those are (mostly) minor, and this is more convenient
+ // than writing getWriter().toString()
+ @Override
+ public String toString() {
+ return contained.toString();
+ }
}