Package com.twelvemonkeys.io
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 class
private static interface
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ByteArrayOutputStream
protected final WriterOutputStream.Decoder
private boolean
private static final boolean
protected Writer
-
Constructor Summary
ConstructorsConstructorDescriptionWriterOutputStream
(Writer pWriter) WriterOutputStream
(Writer pWriter, String pCharset) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
private void
private static WriterOutputStream.Decoder
getDecoder
(String pCharset) private static boolean
static void
final void
write
(byte[] pBytes) final void
write
(byte[] pBytes, int pOffset, int pLength) final void
write
(int pByte) Methods inherited from class java.io.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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public final void write(int pByte) - Specified by:
write
in classOutputStream
-
flushBuffer
- Throws:
IOException
-
main
- Throws:
IOException
-