Class WriterOutputStream
java.lang.Object
java.io.OutputStream
com.twelvemonkeys.io.WriterOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Wraps a
Writer in an OutputStream.
Instances of this class are not thread-safe.
NOTE: This class is probably not the right way of solving your problem,
however it might prove useful in JSPs etc.
If possible, it's always better to use the Writer's underlying
OutputStream, or wrap it's native backing.
- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/WriterOutputStream.java#2 $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static interface////////////////////////////////////////////////////////////////////////private static final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ByteArrayOutputStreamprotected final WriterOutputStream.Decoderprivate booleanprivate static final booleanprotected Writer -
Constructor Summary
ConstructorsConstructorDescriptionWriterOutputStream(Writer pWriter) WriterOutputStream(Writer pWriter, String pCharset) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()private voidprivate static WriterOutputStream.DecodergetDecoder(String pCharset) private static booleanstatic void////////////////////////////////////////////////////////////////////////final voidwrite(byte[] pBytes) final voidwrite(byte[] pBytes, int pOffset, int pLength) final voidwrite(int pByte) Methods inherited from class OutputStream
nullOutputStream
-
Field Details
-
writer
-
decoder
-
bufferStream
-
isFlushing
private volatile boolean isFlushing -
NIO_AVAILABLE
private static final boolean NIO_AVAILABLE
-
-
Constructor Details
-
WriterOutputStream
-
WriterOutputStream
-
-
Method Details
-
isNIOAvailable
private static boolean isNIOAvailable() -
getDecoder
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public final void write(int pByte) - Specified by:
writein classOutputStream
-
flushBuffer
- Throws:
IOException
-
main
////////////////////////////////////////////////////////////////////////- Throws:
IOException
-