Package org.jboss.marshalling
Class LimitedByteOutput
- java.lang.Object
-
- java.io.OutputStream
-
- org.jboss.marshalling.SimpleByteOutput
-
- org.jboss.marshalling.ByteOutputStream
-
- org.jboss.marshalling.LimitedByteOutput
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,ByteOutput
public class LimitedByteOutput extends ByteOutputStream
A limited byte output stream. Throws an exception if too many bytes are written.
-
-
Field Summary
-
Fields inherited from class org.jboss.marshalling.ByteOutputStream
byteOutput
-
-
Constructor Summary
Constructors Constructor Description LimitedByteOutput(ByteOutput byteOutput, long limit)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.-
Methods inherited from class org.jboss.marshalling.ByteOutputStream
close, flush, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
LimitedByteOutput
public LimitedByteOutput(ByteOutput byteOutput, long limit)
Construct a new instance.- Parameters:
byteOutput- the byte output to write tolimit- the byte limit
-
-
Method Detail
-
write
public void write(int b) throws IOExceptionWrites to the output stream the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
writein interfaceByteOutput- Overrides:
writein classByteOutputStream- Parameters:
b- the byte to write- Throws:
IOException- if an error occurs
-
write
public void write(byte[] b, int off, int len) throws IOExceptionWrite some of the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Overrides:
writein classByteOutputStream- Parameters:
b- the byte arrayoff- the index to start writing fromlen- the number of bytes to write- Throws:
IOException- if an error occurs
-
-