Class Buffer

java.lang.Object
org.fusesource.hawtbuf.Buffer
All Implemented Interfaces:
Comparable<Buffer>
Direct Known Subclasses:
AsciiBuffer, UTF8Buffer

public class Buffer extends Object implements Comparable<Buffer>
  • Field Details

    • data

      public byte[] data
    • offset

      public int offset
    • length

      public int length
  • Constructor Details

    • Buffer

      public Buffer(ByteBuffer other)
    • Buffer

      public Buffer(Buffer other)
    • Buffer

      public Buffer(int size)
    • Buffer

      public Buffer(byte[] data)
    • Buffer

      public Buffer(byte[] data, int offset, int length)
  • Method Details

    • hex

      public String hex()
    • flip

      public final Buffer flip()
    • moveHead

      public final Buffer moveHead(int value)
    • moveTail

      public final Buffer moveTail(int value)
    • clear

      public final Buffer clear()
    • slice

      public final Buffer slice(int low, int high)
    • getData

      public final byte[] getData()
    • data

      public final Buffer data(byte[] data)
    • getLength

      public final int getLength()
    • length

      public final int length()
    • length

      public final Buffer length(int length)
    • getOffset

      public final int getOffset()
    • offset

      public final Buffer offset(int offset)
    • deepCopy

      public final Buffer deepCopy()
    • compact

      public final Buffer compact()
    • toByteArray

      public final byte[] toByteArray()
    • get

      public final byte get(int i)
    • equals

      public final boolean equals(Buffer obj)
    • in

      public final BufferInputStream in()
    • out

      public final BufferOutputStream out()
    • bigEndianEditor

      public final BufferEditor bigEndianEditor()
    • littleEndianEditor

      public final BufferEditor littleEndianEditor()
    • isEmpty

      public final boolean isEmpty()
    • contains

      public final boolean contains(byte value)
    • indexOf

      public final int indexOf(byte value)
    • indexOf

      public final int indexOf(byte value, int pos)
    • startsWith

      public final boolean startsWith(Buffer other)
    • indexOf

      public final int indexOf(Buffer needle)
    • indexOf

      public final int indexOf(Buffer needle, int pos)
    • containsAt

      public final boolean containsAt(Buffer needle, int pos)
    • matches

      private final boolean matches(Buffer needle, int pos)
    • trim

      public final Buffer trim()
    • trimEnd

      public final Buffer trimEnd()
    • trimFront

      public final Buffer trimFront()
    • buffer

      public final Buffer buffer()
    • ascii

      public final AsciiBuffer ascii()
    • utf8

      public final UTF8Buffer utf8()
    • split

      public final Buffer[] split(byte separator)
    • reset

      public void reset()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Buffer o)
      Specified by:
      compareTo in interface Comparable<Buffer>
    • writeTo

      public void writeTo(DataOutput out) throws IOException
      same as out.write(data, offset, length);
      Throws:
      IOException
    • writeTo

      public void writeTo(OutputStream out) throws IOException
      same as out.write(data, offset, length);
      Throws:
      IOException
    • readFrom

      public void readFrom(DataInput in) throws IOException
      same as in.readFully(data, offset, length);
      Throws:
      IOException
    • readFrom

      public int readFrom(InputStream in) throws IOException
      same as in.read(data, offset, length);
      Throws:
      IOException
    • string

      public static String string(Buffer value)
    • join

      public static final Buffer join(List<Buffer> items, Buffer seperator)
    • toByteBuffer

      public ByteBuffer toByteBuffer()
    • ascii

      public static AsciiBuffer ascii(String value)
    • ascii

      public static AsciiBuffer ascii(Buffer buffer)
    • utf8

      public static UTF8Buffer utf8(String value)
    • utf8

      public static UTF8Buffer utf8(Buffer buffer)
    • toString

      public String toString()
      Overrides:
      toString in class Object