Class PartialOutputStream
java.lang.Object
java.io.OutputStream
org.jgroups.util.BaseDataOutputStream
org.jgroups.util.PartialOutputStream
- All Implemented Interfaces:
Closeable, DataOutput, Flushable, AutoCloseable
Decorates an output stream (
Example:
DataOutput) and writes only a subset [start..end] (both indices
inclusive) of the original data to the underlying output stream.Example:
start=5, length=5: range=[5..9], bytes are written for positions 5,6,7,8,9 (5 bytes)
- Since:
- 5.0
- Author:
- Bela Ban
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final intprotected final DataOutputFields inherited from class BaseDataOutputStream
grow_exponentially, pos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_write(byte[] b, int off, int len) protected void_write(int b) protected voidensureCapacity(int bytes) Makes sure that bytes can be written to the output stream (e.g.protected booleaninRange()Checks if pos is in range [offset..end]intNumber of bytes left to be writtentoString()voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class BaseDataOutputStream
checkBounds, growExponentially, growExponentially, position, position, reset, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFMethods inherited from class OutputStream
close, flush, nullOutputStream, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DataOutput
write
-
Field Details
-
out
-
offset
protected final int offset -
end
protected final int end
-
-
Constructor Details
-
PartialOutputStream
-
-
Method Details
-
write
public void write(int b) - Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream
-
write
public void write(byte[] b, int off, int len) - Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream
-
remaining
public int remaining()Number of bytes left to be written -
toString
- Overrides:
toStringin classBaseDataOutputStream
-
ensureCapacity
protected void ensureCapacity(int bytes) Description copied from class:BaseDataOutputStreamMakes sure that bytes can be written to the output stream (e.g. a byte array has enough space left)- Specified by:
ensureCapacityin classBaseDataOutputStream
-
_write
protected void _write(int b) -
_write
protected void _write(byte[] b, int off, int len) -
inRange
protected boolean inRange()Checks if pos is in range [offset..end]
-