Package com.twelvemonkeys.io.enc
Class EncoderStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.twelvemonkeys.io.enc.EncoderStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class EncoderStream extends java.io.FilterOutputStream
AnOutputStream
that provides on-the-fly encoding to an underlying stream.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java#2 $
- Author:
- Harald Kuhr
- See Also:
DecoderStream
,Encoder
-
-
Constructor Summary
Constructors Constructor Description EncoderStream(java.io.OutputStream pStream, Encoder pEncoder)
Creates an output stream filter built on top of the specified underlying output stream.EncoderStream(java.io.OutputStream pStream, Encoder pEncoder, boolean pFlushOnWrite)
Creates an output stream filter built on top of the specified underlying output stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(byte[] pBytes)
void
write(byte[] pBytes, int pOffset, int pLength)
void
write(int pByte)
-
-
-
Field Detail
-
encoder
protected final Encoder encoder
-
buffer
protected final java.nio.ByteBuffer buffer
-
-
Constructor Detail
-
EncoderStream
public EncoderStream(java.io.OutputStream pStream, Encoder pEncoder)
Creates an output stream filter built on top of the specified underlying output stream.- Parameters:
pStream
- the underlying output streampEncoder
- the encoder to use
-
EncoderStream
public EncoderStream(java.io.OutputStream pStream, Encoder pEncoder, boolean pFlushOnWrite)
Creates an output stream filter built on top of the specified underlying output stream.- Parameters:
pStream
- the underlying output streampEncoder
- the encoder to usepFlushOnWrite
- iftrue
, calls to the byte-arraywrite
methods will automatically flush the buffer.
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public final void write(byte[] pBytes) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] pBytes, int pOffset, int pLength) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(int pByte) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
-