Package org.jboss.marshalling
Class ByteOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.jboss.marshalling.SimpleByteOutput
-
- org.jboss.marshalling.ByteOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,ByteOutput
- Direct Known Subclasses:
LimitedByteOutput,SimpleDataOutput
public class ByteOutputStream extends SimpleByteOutput
AnOutputStreamwhich implementsByteOutputand 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 ByteOutputbyteOutput
-
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 voidclose()voidflush()voidwrite(byte[] b)Write all the bytes from the given array to the stream.voidwrite(byte[] b, int off, int len)Write some of the bytes from the given array to the stream.voidwrite(int b)Writes to the output stream the eight low-order bits of the argumentb.
-
-
-
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 java.io.IOExceptionWrites to the output stream the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
writein interfaceByteOutput- Specified by:
writein classjava.io.OutputStream- Parameters:
b- the byte to write- Throws:
java.io.IOException- if an error occurs
-
write
public void write(byte[] b) throws java.io.IOExceptionWrite all the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the byte array- Throws:
java.io.IOException- if an error occurs
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrite some of the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the byte arrayoff- the index to start writing fromlen- the number of bytes to write- Throws:
java.io.IOException- if an error occurs
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-