Constructors Summary |
---|
public SafePrintWriter(Writer out, String lineSeparator)
this(out, false, lineSeparator);
|
public SafePrintWriter(Writer out, char lineSeparator)
this(out, false, String.valueOf(lineSeparator));
|
public SafePrintWriter(Writer out, boolean autoFlush, String lineSeparator)
super(out);
this.out = out;
this.autoFlush = autoFlush;
if (lineSeparator == null) {
throw new NullPointerException("Null line separator");
}
this.lineSeparator = lineSeparator;
|
public SafePrintWriter(OutputStream out, boolean autoFlush, String encoding, String lineSeparator)
this(new OutputStreamWriter(out, encoding), autoFlush, lineSeparator);
|
Methods Summary |
---|
public void | close()
try {
this.flush();
}
catch (IOException ex) {
}
synchronized (lock) {
out.close();
this.closed = true;
}
|
public void | flush()
synchronized (lock) {
if (closed) throw new IOException("Stream closed");
out.flush();
}
|
public void | print(boolean b)
if (b) this.write("true");
else this.write("false");
|
public void | print(char c)
this.write(String.valueOf(c));
|
public void | print(int i)
this.write(String.valueOf(i));
|
public void | print(long l)
this.write(String.valueOf(l));
|
public void | print(float f)
this.write(String.valueOf(f));
|
public void | print(double d)
this.write(String.valueOf(d));
|
public void | print(char[] text)
this.write(text);
|
public void | print(java.lang.String s)
if (s == null) this.write("null");
else this.write(s);
|
public void | print(java.lang.Object o)
if (o == null) this.write("null");
else this.write(o.toString());
|
public void | println(boolean b)
if (b) this.write("true");
else this.write("false");
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(char c)
this.write(String.valueOf(c));
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(int i)
this.write(String.valueOf(i));
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(long l)
this.write(String.valueOf(l));
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(float f)
this.write(String.valueOf(f));
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(double d)
this.write(String.valueOf(d));
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(char[] text)
this.write(text);
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(java.lang.String s)
if (s == null) this.write("null");
else this.write(s);
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println(java.lang.Object o)
if (o == null) this.write("null");
else this.write(o.toString());
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | println()
this.write(lineSeparator);
if (autoFlush) out.flush();
|
public void | write(java.lang.String s, int offset, int length)
synchronized (lock) {
if (closed) throw new IOException("Stream closed");
out.write(s, offset, length);
}
|
public void | write(int c)
synchronized (lock) {
if (closed) throw new IOException("Stream closed");
out.write(c);
}
|
public void | write(char[] text, int offset, int length)
synchronized (lock) {
if (closed) throw new IOException("Stream closed");
out.write(text, offset, length);
}
|
public void | write(char[] text)
synchronized (lock) {
if (closed) throw new IOException("Stream closed");
out.write(text, 0, text.length);
}
|