|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer java.io.OutputStreamWriter de.lmu.ifi.dbs.elki.logging.OutputStreamLogger
public class OutputStreamLogger
Class to write to Output Streams, IGNORING close()
, with a special
newline handling and always flushing.
This is meant to wrap logging output to the console.
Field Summary | |
---|---|
protected static char |
CARRIAGE_RETURN
Carriage return character. |
private int |
charsSinceNewline
Flag to signal if we have had a newline recently. |
static String |
NEWLINE
Newline string. |
static char[] |
NEWLINEC
Newline as char array. |
static char |
UNIX_NEWLINE
Unix newline |
static String |
WHITESPACE
Whitespace. |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
OutputStreamLogger(OutputStream out)
Constructor. |
|
OutputStreamLogger(OutputStream out,
Charset cs)
Constructor. |
|
OutputStreamLogger(OutputStream out,
CharsetEncoder enc)
Constructor. |
|
OutputStreamLogger(OutputStream out,
String charsetName)
Constructor. |
Method Summary | |
---|---|
void |
close()
Close command - will be IGNORED. |
private int |
countNonNewline(char[] cbuf,
int off,
int len)
Count the number of non-newline characters before first newline in the string. |
private int |
countNonNewline(String str,
int off,
int len)
Count the number of non-newline characters before first newline in the string. |
private int |
tailingNonNewline(char[] cbuf,
int off,
int len)
Count the tailing non-newline characters. |
private int |
tailingNonNewline(String str,
int off,
int len)
Count the tailing non-newline characters. |
void |
write(char[] cbuf,
int off,
int len)
Writer that keeps track of when it hasn't seen a newline yet, will auto-insert newlines except when lines start with a carriage return. |
void |
write(String str,
int off,
int len)
Writer that keeps track of when it hasn't seen a newline yet, will auto-insert newlines except when lines start with a carriage return. |
Methods inherited from class java.io.OutputStreamWriter |
---|
flush, getEncoding, write |
Methods inherited from class java.io.Writer |
---|
append, append, append, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int charsSinceNewline
protected static final char CARRIAGE_RETURN
public static final char UNIX_NEWLINE
public static final String NEWLINE
public static final char[] NEWLINEC
public static final String WHITESPACE
Constructor Detail |
---|
public OutputStreamLogger(OutputStream out)
out
- Output streampublic OutputStreamLogger(OutputStream out, String charsetName) throws UnsupportedEncodingException
out
- Output streamcharsetName
- Character set name
UnsupportedEncodingException
- thrown on unknown character setspublic OutputStreamLogger(OutputStream out, Charset cs)
out
- Output Streamcs
- Character set to usepublic OutputStreamLogger(OutputStream out, CharsetEncoder enc)
out
- Output Streamenc
- Charset encoderMethod Detail |
---|
public void close()
close
in interface Closeable
close
in class OutputStreamWriter
private int tailingNonNewline(char[] cbuf, int off, int len)
cbuf
- Character bufferoff
- Offsetlen
- Range
private int tailingNonNewline(String str, int off, int len)
str
- Stringoff
- Offsetlen
- Range
private int countNonNewline(char[] cbuf, int off, int len)
cbuf
- character bufferoff
- offsetlen
- length
private int countNonNewline(String str, int off, int len)
str
- Stringoff
- offsetlen
- length
public void write(char[] cbuf, int off, int len) throws IOException
write
in class OutputStreamWriter
IOException
public void write(String str, int off, int len) throws IOException
write
in class OutputStreamWriter
IOException
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |