lots of new instructions and bugfixes

This commit is contained in:
Joel Dice
2007-09-29 20:48:27 -06:00
parent b0500a881c
commit 8ae36c05b7
7 changed files with 308 additions and 73 deletions

View File

@ -1,12 +1,14 @@
package java.io;
public class PrintStream extends OutputStream {
private static final byte[] newline
= System.getProperty("line.separator").getBytes();
private final OutputStream out;
private final boolean autoFlush;
private static class Static {
private static final byte[] newline
= System.getProperty("line.separator").getBytes();
}
public PrintStream(OutputStream out, boolean autoFlush) {
this.out = out;
this.autoFlush = autoFlush;
@ -33,14 +35,14 @@ public class PrintStream extends OutputStream {
public synchronized void println(String s) {
try {
out.write(s.getBytes());
out.write(newline);
out.write(Static.newline);
if (autoFlush) flush();
} catch (IOException e) { }
}
public synchronized void println() {
try {
out.write(newline);
out.write(Static.newline);
if (autoFlush) flush();
} catch (IOException e) { }
}