Package org.jgroups.util
Class PartialOutputStream
- java.lang.Object
-
- org.jgroups.util.BaseDataOutputStream
-
- org.jgroups.util.PartialOutputStream
-
- All Implemented Interfaces:
java.io.DataOutput
public class PartialOutputStream extends BaseDataOutputStream
Decorates an output stream (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
Fields Modifier and Type Field Description protected intendprotected intoffsetprotected java.io.DataOutputout-
Fields inherited from class org.jgroups.util.BaseDataOutputStream
pos
-
-
Constructor Summary
Constructors Constructor Description PartialOutputStream(java.io.DataOutput out, int offset, int length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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]intremaining()Number of bytes left to be writtenjava.lang.StringtoString()voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class org.jgroups.util.BaseDataOutputStream
checkBounds, position, position, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Method Detail
-
write
public void write(int b)
- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein classBaseDataOutputStream
-
write
public void write(byte[] b, int off, int len)- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein classBaseDataOutputStream
-
remaining
public int remaining()
Number of bytes left to be written
-
toString
public java.lang.String 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]
-
-