Class BaseDataOutputStream
java.lang.Object
java.io.OutputStream
org.jgroups.util.BaseDataOutputStream
- All Implemented Interfaces:
Closeable, DataOutput, Flushable, AutoCloseable
- Direct Known Subclasses:
ByteArrayDataOutputStream, ByteBufferOutputStream, PartialOutputStream
Implements
DataOutput in a generic manner, so that subclasses can implement specific behavior. Some write()
methods are abstract and need to be implemennted in subclasses. Filed pos points to the current
write-position.- Since:
- 5.0
- Author:
- Bela Ban
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcheckBounds(int pos) protected abstract voidensureCapacity(int bytes) Makes sure that bytes can be written to the output stream (e.g.booleangrowExponentially(boolean b) intposition()position(int pos) reset()toString()voidwriteBoolean(boolean v) voidwriteByte(int v) voidwriteBytes(String s) voidwriteChar(int v) voidwriteChars(String s) voidwriteDouble(double v) voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidwriteShort(int v) voidMethods inherited from class OutputStream
close, flush, nullOutputStream, write, write, writeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DataOutput
write, write, write
-
Field Details
-
pos
protected int pos -
grow_exponentially
protected boolean grow_exponentially
-
-
Constructor Details
-
BaseDataOutputStream
public BaseDataOutputStream()
-
-
Method Details
-
reset
-
position
-
position
public int position() -
growExponentially
public boolean growExponentially() -
growExponentially
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
toString
-
checkBounds
protected int checkBounds(int pos) -
ensureCapacity
protected abstract void ensureCapacity(int bytes) Makes sure that bytes can be written to the output stream (e.g. a byte array has enough space left)
-