Package org.fusesource.hawtbuf
Class BufferEditor
- java.lang.Object
-
- org.fusesource.hawtbuf.AbstractVarIntSupport
-
- org.fusesource.hawtbuf.BufferEditor
-
- Direct Known Subclasses:
BufferEditor.BigEndianBufferEditor,BufferEditor.LittleEndianBufferEditor
public abstract class BufferEditor extends AbstractVarIntSupport
Used to write and read primitives to and from a Buffer. Reads and writes are done at the buffers offset. Every read and write increases the buffer's offset and decreases the buffer's length.
Bounds checking are only performed when assertions are enabled on the JVM. It's up to you to make sure there is enough data/space in the buffer to do the read or write.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classBufferEditor.BigEndianBufferEditor(package private) static classBufferEditor.LittleEndianBufferEditor
-
Constructor Summary
Constructors Modifier Constructor Description privateBufferEditor(Buffer buffer)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BufferEditorbig(Buffer buffer)protected booleanhasCapacity(int len)static BufferEditorlittle(Buffer buffer)intread()booleanreadBoolean()bytereadByte()abstract charreadChar()abstract doublereadDouble()abstract floatreadFloat()voidreadFully(byte[] b)voidreadFully(byte[] b, int off, int len)abstract intreadInt()abstract longreadLong()abstract shortreadShort()intreadUnsignedByte()abstract intreadUnsignedShort()intskipBytes(int n)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwriteBoolean(boolean v)voidwriteByte(int v)abstract voidwriteChar(int v)abstract voidwriteDouble(double v)abstract voidwriteFloat(float v)abstract voidwriteInt(int v)abstract voidwriteLong(long v)abstract voidwriteRawDouble(double v)abstract voidwriteRawFloat(float v)abstract voidwriteShort(int v)-
Methods inherited from class org.fusesource.hawtbuf.AbstractVarIntSupport
computeVarIntSize, computeVarLongSize, computeVarSignedIntSize, computeVarSignedLongSize, readVarInt, readVarLong, readVarSignedInt, readVarSignedLong, writeVarInt, writeVarLong, writeVarSignedInt, writeVarSignedLong
-
-
-
-
Field Detail
-
buffer
protected final Buffer buffer
-
-
Constructor Detail
-
BufferEditor
private BufferEditor(Buffer buffer)
-
-
Method Detail
-
hasCapacity
protected boolean hasCapacity(int len)
-
read
public int read()
-
readFully
public void readFully(byte[] b)
-
readFully
public void readFully(byte[] b, int off, int len)
-
skipBytes
public int skipBytes(int n)
-
readBoolean
public boolean readBoolean()
-
readByte
public byte readByte()
- Specified by:
readBytein classAbstractVarIntSupport
-
readUnsignedByte
public int readUnsignedByte()
-
write
public void write(int b)
-
write
public void write(byte[] b)
-
write
public void write(byte[] b, int off, int len)
-
writeBoolean
public void writeBoolean(boolean v)
-
writeByte
public void writeByte(int v)
- Specified by:
writeBytein classAbstractVarIntSupport
-
readShort
public abstract short readShort()
-
readUnsignedShort
public abstract int readUnsignedShort()
-
readChar
public abstract char readChar()
-
readInt
public abstract int readInt()
-
readLong
public abstract long readLong()
-
readDouble
public abstract double readDouble()
-
readFloat
public abstract float readFloat()
-
writeShort
public abstract void writeShort(int v)
-
writeChar
public abstract void writeChar(int v)
-
writeInt
public abstract void writeInt(int v)
-
writeLong
public abstract void writeLong(long v)
-
writeDouble
public abstract void writeDouble(double v)
-
writeFloat
public abstract void writeFloat(float v)
-
writeRawDouble
public abstract void writeRawDouble(double v)
-
writeRawFloat
public abstract void writeRawFloat(float v)
-
big
public static BufferEditor big(Buffer buffer)
-
little
public static BufferEditor little(Buffer buffer)
-
-