Package com.aoindustries.io
Class PrintStreamOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.aoindustries.io.PrintStreamOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class PrintStreamOutputStream extends OutputStream
Wraps a PrintStream to be an OutputStream. Although PrintStream subclasses OutputStream, it handles errors differently. This calls checkError after every write to properly detect and throw exceptions as expected for an OutputStream. Because checkError is documented as flushing the stream this may have an adverse affect on performance.- Author:
- AO Industries, Inc.
-
-
Constructor Summary
Constructors Constructor Description PrintStreamOutputStream(PrintStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
PrintStreamOutputStream
public PrintStreamOutputStream(PrintStream out)
-
-
Method Detail
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
-