Methods Summary |
---|
public synchronized java.io.PrintStream | append(char c)
print(c);
return this;
|
public synchronized java.io.PrintStream | append(java.lang.CharSequence csq)
builder.append(csq);
flush(false);
return this;
|
public synchronized java.io.PrintStream | append(java.lang.CharSequence csq, int start, int end)
builder.append(csq, start, end);
flush(false);
return this;
|
public boolean | checkError()Always returns false.
return false;
|
public void | close()Ignored. /* ignored */
|
public synchronized void | flush()
flush(true);
|
private void | flush(boolean completely)Searches buffer for line breaks and logs a message for each one.
int length = builder.length();
int start = 0;
int nextBreak;
// Log one line for each line break.
while (start < length
&& (nextBreak = builder.indexOf("\n", start)) != -1) {
log(builder.substring(start, nextBreak));
start = nextBreak + 1;
}
if (completely) {
// Log the remainder of the buffer.
if (start < length) {
log(builder.substring(start));
}
builder.setLength(0);
} else {
// Delete characters leading up to the next starting point.
builder.delete(0, start);
}
|
public java.io.PrintStream | format(java.lang.String format, java.lang.Object args)
return format(Locale.getDefault(), format, args);
|
public synchronized java.io.PrintStream | format(java.util.Locale l, java.lang.String format, java.lang.Object args)
if (format == null) {
throw new NullPointerException("format");
}
formatter.format(l, format, args);
flush(false);
return this;
|
protected abstract void | log(java.lang.String line)Logs the given line.
|
public synchronized void | print(char[] charArray)
builder.append(charArray);
flush(false);
|
public synchronized void | print(char ch)
builder.append(ch);
if (ch == '\n") {
flush(false);
}
|
public synchronized void | print(double dnum)
builder.append(dnum);
|
public synchronized void | print(float fnum)
builder.append(fnum);
|
public synchronized void | print(int inum)
builder.append(inum);
|
public synchronized void | print(long lnum)
builder.append(lnum);
|
public synchronized void | print(java.lang.Object obj)
builder.append(obj);
flush(false);
|
public synchronized void | print(java.lang.String str)
builder.append(str);
flush(false);
|
public synchronized void | print(boolean bool)
builder.append(bool);
|
public java.io.PrintStream | printf(java.lang.String format, java.lang.Object args)
return format(format, args);
|
public java.io.PrintStream | printf(java.util.Locale l, java.lang.String format, java.lang.Object args)
return format(l, format, args);
|
public synchronized void | println()
flush(true);
|
public synchronized void | println(char[] charArray)
builder.append(charArray);
flush(true);
|
public synchronized void | println(char ch)
builder.append(ch);
flush(true);
|
public synchronized void | println(double dnum)
builder.append(dnum);
flush(true);
|
public synchronized void | println(float fnum)
builder.append(fnum);
flush(true);
|
public synchronized void | println(int inum)
builder.append(inum);
flush(true);
|
public synchronized void | println(long lnum)
builder.append(lnum);
flush(true);
|
public synchronized void | println(java.lang.Object obj)
builder.append(obj);
flush(true);
|
public synchronized void | println(java.lang.String s)
if (builder.length() == 0 && s != null) {
// Optimization for a simple println.
int length = s.length();
int start = 0;
int nextBreak;
// Log one line for each line break.
while (start < length
&& (nextBreak = s.indexOf('\n", start)) != -1) {
log(s.substring(start, nextBreak));
start = nextBreak + 1;
}
if (start < length) {
log(s.substring(start));
}
} else {
builder.append(s);
flush(true);
}
|
public synchronized void | println(boolean bool)
builder.append(bool);
flush(true);
|
protected void | setError()Ignored. /* ignored */
|
public void | write(int oneByte)
write(new byte[] { (byte) oneByte }, 0, 1);
|
public void | write(byte[] buffer)
write(buffer, 0, buffer.length);
|
public synchronized void | write(byte[] bytes, int start, int count)
if (decoder == null) {
encodedBytes = ByteBuffer.allocate(80);
decodedChars = CharBuffer.allocate(80);
decoder = Charset.defaultCharset().newDecoder()
.onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE);
}
int end = start + count;
while (start < end) {
// copy some bytes from the array to the long-lived buffer. This
// way, if we end with a partial character we don't lose it.
int numBytes = Math.min(encodedBytes.remaining(), end - start);
encodedBytes.put(bytes, start, numBytes);
start += numBytes;
encodedBytes.flip();
CoderResult coderResult;
do {
// decode bytes from the byte buffer into the char buffer
coderResult = decoder.decode(encodedBytes, decodedChars, false);
// copy chars from the char buffer into our string builder
decodedChars.flip();
builder.append(decodedChars);
decodedChars.clear();
} while (coderResult.isOverflow());
encodedBytes.compact();
}
flush(false);
|