org.fusesource.hawtbuf
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>
- Author:
- Hiram Chirino
Method Summary |
AsciiBuffer |
ascii()
|
static AsciiBuffer |
ascii(Buffer buffer)
|
static AsciiBuffer |
ascii(String value)
|
BufferEditor |
bigEndianEditor()
|
Buffer |
buffer()
|
Buffer |
clear()
|
Buffer |
compact()
|
int |
compareTo(Buffer o)
|
boolean |
contains(byte value)
|
boolean |
containsAt(Buffer needle,
int pos)
|
Buffer |
data(byte[] data)
|
Buffer |
deepCopy()
|
boolean |
equals(Buffer obj)
|
boolean |
equals(Object obj)
|
Buffer |
flip()
|
byte |
get(int i)
|
byte[] |
getData()
|
int |
getLength()
|
int |
getOffset()
|
int |
hashCode()
|
String |
hex()
|
BufferInputStream |
in()
|
int |
indexOf(Buffer needle)
|
int |
indexOf(Buffer needle,
int pos)
|
int |
indexOf(byte value)
|
int |
indexOf(byte value,
int pos)
|
boolean |
isEmpty()
|
static Buffer |
join(List<Buffer> items,
Buffer seperator)
|
int |
length()
|
Buffer |
length(int length)
|
BufferEditor |
littleEndianEditor()
|
Buffer |
moveHead(int value)
|
Buffer |
moveTail(int value)
|
Buffer |
offset(int offset)
|
BufferOutputStream |
out()
|
void |
readFrom(DataInput in)
same as in.readFully(data, offset, length); |
int |
readFrom(InputStream in)
same as in.read(data, offset, length); |
void |
reset()
|
Buffer |
slice(int low,
int high)
|
Buffer[] |
split(byte separator)
|
boolean |
startsWith(Buffer other)
|
static String |
string(Buffer value)
|
byte[] |
toByteArray()
|
ByteBuffer |
toByteBuffer()
|
String |
toString()
|
Buffer |
trim()
|
Buffer |
trimEnd()
|
Buffer |
trimFront()
|
UTF8Buffer |
utf8()
|
static UTF8Buffer |
utf8(Buffer buffer)
|
static UTF8Buffer |
utf8(String value)
|
void |
writeTo(DataOutput out)
same as out.write(data, offset, length); |
void |
writeTo(OutputStream out)
same as out.write(data, offset, length); |
data
public byte[] data
offset
public int offset
length
public int length
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)
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)
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
Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.