org.fusesource.hawtbuf
Class BufferEditor

java.lang.Object
  extended by org.fusesource.hawtbuf.AbstractVarIntSupport
      extended by org.fusesource.hawtbuf.BufferEditor

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.

Author:
Hiram Chirino

Field Summary
protected  Buffer buffer
           
 
Method Summary
static BufferEditor big(Buffer buffer)
           
protected  boolean hasCapacity(int len)
           
static BufferEditor little(Buffer buffer)
           
 int read()
           
 boolean readBoolean()
           
 byte readByte()
           
abstract  char readChar()
           
abstract  double readDouble()
           
abstract  float readFloat()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
abstract  int readInt()
           
abstract  long readLong()
           
abstract  short readShort()
           
 int readUnsignedByte()
           
abstract  int readUnsignedShort()
           
 int skipBytes(int n)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeBoolean(boolean v)
           
 void writeByte(int v)
           
abstract  void writeChar(int v)
           
abstract  void writeDouble(double v)
           
abstract  void writeFloat(float v)
           
abstract  void writeInt(int v)
           
abstract  void writeLong(long v)
           
abstract  void writeRawDouble(double v)
           
abstract  void writeRawFloat(float v)
           
abstract  void writeShort(int v)
           
 
Methods inherited from class org.fusesource.hawtbuf.AbstractVarIntSupport
computeVarIntSize, computeVarLongSize, computeVarSignedIntSize, computeVarSignedLongSize, readVarInt, readVarLong, readVarSignedInt, readVarSignedLong, writeVarInt, writeVarLong, writeVarSignedInt, writeVarSignedLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected final 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:
readByte in class AbstractVarIntSupport

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:
writeByte in class AbstractVarIntSupport

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)


Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.