Package org.jboss.marshalling
Class ByteOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.jboss.marshalling.SimpleByteOutput
-
- org.jboss.marshalling.ByteOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,ByteOutput
- Direct Known Subclasses:
LimitedByteOutput
,SimpleDataOutput
public class ByteOutputStream extends SimpleByteOutput
AnOutputStream
which implementsByteOutput
and writes bytes to anotherByteOutput
. Usually theMarshalling.createByteOutput(OutputStream)
method should be used to create instances because it can detect when the target already implementsByteOutput
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteOutput
byteOutput
-
Constructor Summary
Constructors Constructor Description ByteOutputStream(ByteOutput byteOutput)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(byte[] b)
Write all the bytes from the given array to the stream.void
write(byte[] b, int off, int len)
Write some of the bytes from the given array to the stream.void
write(int b)
Writes to the output stream the eight low-order bits of the argumentb
.-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
byteOutput
protected volatile ByteOutput byteOutput
-
-
Constructor Detail
-
ByteOutputStream
public ByteOutputStream(ByteOutput byteOutput)
Construct a new instance.- Parameters:
byteOutput
- the byte output to write to
-
-
Method Detail
-
write
public void write(int b) throws IOException
Writes to the output stream the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
write
in interfaceByteOutput
- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to write- Throws:
IOException
- if an error occurs
-
write
public void write(byte[] b) throws IOException
Write all the bytes from the given array to the stream.- Specified by:
write
in interfaceByteOutput
- Overrides:
write
in classOutputStream
- Parameters:
b
- the byte array- Throws:
IOException
- if an error occurs
-
write
public void write(byte[] b, int off, int len) throws IOException
Write some of the bytes from the given array to the stream.- Specified by:
write
in interfaceByteOutput
- Overrides:
write
in classOutputStream
- Parameters:
b
- the byte arrayoff
- the index to start writing fromlen
- the number of bytes to write- Throws:
IOException
- if an error occurs
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-