Package org.jgroups.util
Class BaseDataOutputStream
- java.lang.Object
-
- org.jgroups.util.BaseDataOutputStream
-
- All Implemented Interfaces:
java.io.DataOutput
- Direct Known Subclasses:
ByteArrayDataOutputStream
,PartialOutputStream
public abstract class BaseDataOutputStream extends java.lang.Object implements java.io.DataOutput
ImplementsDataOutput
in a generic manner, so that subclasses can implement specific behavior. Some write() methods are abstract and need to be implemennted in subclasses. Filedpos
points to the current write-position.- Since:
- 5.0
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected int
pos
-
Constructor Summary
Constructors Constructor Description BaseDataOutputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
checkBounds(int pos)
protected abstract void
ensureCapacity(int bytes)
Makes sure that bytes can be written to the output stream (e.g.int
position()
BaseDataOutputStream
position(int pos)
java.lang.String
toString()
void
write(byte[] b)
abstract void
write(byte[] b, int off, int len)
abstract void
write(int b)
void
writeBoolean(boolean v)
void
writeByte(int v)
void
writeBytes(java.lang.String s)
void
writeChar(int v)
void
writeChars(java.lang.String s)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeShort(int v)
void
writeUTF(java.lang.String str)
-
-
-
Method Detail
-
position
public BaseDataOutputStream position(int pos)
-
position
public int position()
-
write
public abstract void write(int b)
- Specified by:
write
in interfacejava.io.DataOutput
-
write
public void write(byte[] b)
- Specified by:
write
in interfacejava.io.DataOutput
-
write
public abstract void write(byte[] b, int off, int len)
- Specified by:
write
in interfacejava.io.DataOutput
-
writeBoolean
public void writeBoolean(boolean v)
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
-
writeByte
public void writeByte(int v)
- Specified by:
writeByte
in interfacejava.io.DataOutput
-
writeShort
public void writeShort(int v)
- Specified by:
writeShort
in interfacejava.io.DataOutput
-
writeChar
public void writeChar(int v)
- Specified by:
writeChar
in interfacejava.io.DataOutput
-
writeInt
public void writeInt(int v)
- Specified by:
writeInt
in interfacejava.io.DataOutput
-
writeLong
public void writeLong(long v)
- Specified by:
writeLong
in interfacejava.io.DataOutput
-
writeFloat
public void writeFloat(float v)
- Specified by:
writeFloat
in interfacejava.io.DataOutput
-
writeDouble
public void writeDouble(double v)
- Specified by:
writeDouble
in interfacejava.io.DataOutput
-
writeBytes
public void writeBytes(java.lang.String s)
- Specified by:
writeBytes
in interfacejava.io.DataOutput
-
writeChars
public void writeChars(java.lang.String s)
- Specified by:
writeChars
in interfacejava.io.DataOutput
-
writeUTF
public void writeUTF(java.lang.String str)
- Specified by:
writeUTF
in interfacejava.io.DataOutput
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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)
-
-