public class EncodingOutputStream extends FilterOutputStream
Encoder
such that encoded data is
written to the underlying output stream.out
Constructor and Description |
---|
EncodingOutputStream(OutputStream out,
Encoder e)
Creates a new instance that wraps the given stream and performs encoding
using the given encoder component.
|
Modifier and Type | Method and Description |
---|---|
static EncodingOutputStream |
base64(OutputStream out)
Creates a new instance that produces base64 output in the given stream.
|
static EncodingOutputStream |
base64(OutputStream out,
int lineLength)
Creates a new instance that produces base64 output in the given stream.
|
void |
close() |
void |
flush() |
static EncodingOutputStream |
hex(OutputStream out)
Creates a new instance that produces hexadecimal output in the given
stream.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public EncodingOutputStream(OutputStream out, Encoder e)
out
- Output stream to wrap.e
- Encoder that provides on-the-fly encoding.public void write(int b) throws IOException
write
in class FilterOutputStream
IOException
public void write(byte[] b) throws IOException
write
in class FilterOutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class FilterOutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class FilterOutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
public static EncodingOutputStream base64(OutputStream out)
NOTE: there are no line breaks in the output with this version.
out
- Wrapped output stream.public static EncodingOutputStream base64(OutputStream out, int lineLength)
NOTE: this version supports output with configurable line breaks.
out
- Wrapped output stream.lineLength
- Length of each base64-encoded line in output. A zero or
negative value disables line breaks.public static EncodingOutputStream hex(OutputStream out)
NOTE: there are no line breaks in the output.
out
- Wrapped output stream.Copyright © 2016 JBoss by Red Hat. All rights reserved.