Package javaforce

Class JFByteBuffer

java.lang.Object
javaforce.JFByteBuffer

public class JFByteBuffer extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    JFByteBuffer(int max_length)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Bytes that can be written (appended).
    void
    Moves any data left in the buffer to the start of the buffer.
    byte[]
    Returns underlying byte buffer.
    int
    Bytes that can read.
    int
    Returns read offset in buffer.
    int
    indexOf(byte[] key)
    Searches for key and returns index.
    byte
    Read one byte.
    boolean
    readBytes(byte[] out, int off, int len)
    Reads bytes placing them in out array.
    int
    readBytes(OutputStream os, int max_bytes)
    Reads bytes placing them in OutputStream.
    int
    Read one int.
    long
    Read one long.
    short
    Read one short.
    readString(int strlen)
    Reads a string of specified length.
    void
    Resets buffer length and read/write offsets.
    void
    skip(int bytes)
    Skips bytes
    boolean
    startsWith(byte[] key)
    Checks if buffer starts with key bytes.
    boolean
    write(byte b)
    Write (appends) one byte.
    boolean
    write(byte[] in, int off, int len)
    Appends in array to buffer.
    boolean
    write(int len)
    Writes (appends) one int.
    boolean
    write(long len)
    Writes (appends) one long.
    boolean
    write(short len)
    Writes (appends) one short.
    int
    write(InputStream is, int max_bytes)
    Appends bytes from InputStream to buffer.
    boolean
    Appends string to buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JFByteBuffer

      public JFByteBuffer(int max_length)
  • Method Details

    • reset

      public void reset()
      Resets buffer length and read/write offsets.
    • getBuffer

      public byte[] getBuffer()
      Returns underlying byte buffer.
    • getOffset

      public int getOffset()
      Returns read offset in buffer.
    • getLength

      public int getLength()
      Bytes that can read.
    • available

      public int available()
      Bytes that can be written (appended).
    • compact

      public void compact()
      Moves any data left in the buffer to the start of the buffer.
    • indexOf

      public int indexOf(byte[] key)
      Searches for key and returns index. Returns -1 if not found.
    • startsWith

      public boolean startsWith(byte[] key)
      Checks if buffer starts with key bytes.
    • skip

      public void skip(int bytes)
      Skips bytes
    • readByte

      public byte readByte()
      Read one byte. Returns -1 if buffer is empty.
    • readShort

      public short readShort()
      Read one short. Returns -1 if buffer is empty.
    • readInt

      public int readInt()
      Read one int. Returns -1 if buffer is empty.
    • readLong

      public long readLong()
      Read one long. Returns -1 if buffer is empty.
    • readBytes

      public boolean readBytes(byte[] out, int off, int len)
      Reads bytes placing them in out array.
    • readBytes

      public int readBytes(OutputStream os, int max_bytes)
      Reads bytes placing them in OutputStream.
    • readString

      public String readString(int strlen)
      Reads a string of specified length.
    • write

      public boolean write(byte b)
      Write (appends) one byte.
    • write

      public boolean write(short len)
      Writes (appends) one short.
    • write

      public boolean write(int len)
      Writes (appends) one int.
    • write

      public boolean write(long len)
      Writes (appends) one long.
    • write

      public boolean write(byte[] in, int off, int len)
      Appends in array to buffer.
    • write

      public boolean write(String s)
      Appends string to buffer.
    • write

      public int write(InputStream is, int max_bytes)
      Appends bytes from InputStream to buffer.