public class FastByteBuffer
extends java.lang.Object
byte
buffer. Works faster for smaller buffer sizes.
After eg. length of 2048 the performances are practically the same.Constructor and Description |
---|
FastByteBuffer()
Creates a new
byte buffer. |
FastByteBuffer(int size)
Creates a new
byte buffer, with a buffer capacity of
the specified size. |
Modifier and Type | Method and Description |
---|---|
void |
append(byte element)
Appends single
byte to buffer. |
FastByteBuffer |
append(byte[] array)
Appends
byte array to buffer. |
FastByteBuffer |
append(byte[] array,
int off,
int len)
Appends
byte array to buffer. |
FastByteBuffer |
append(FastByteBuffer buff)
Appends another fast buffer to this one.
|
void |
clear()
Resets the buffer content.
|
byte |
get(int index)
Returns
byte element at given index. |
boolean |
isEmpty()
Tests if this buffer has no elements.
|
int |
size()
Returns buffer size.
|
byte[] |
toArray()
Creates
byte array from buffered content. |
byte[] |
toArray(int start,
int len)
Creates
byte subarray from buffered content. |
public FastByteBuffer()
byte
buffer. The buffer capacity is
initially 64 bytes, though its size increases if necessary.public FastByteBuffer(int size)
byte
buffer, with a buffer capacity of
the specified size.size
- the initial size.java.lang.IllegalArgumentException
- if size is negative.public void append(byte element)
byte
to buffer.public FastByteBuffer append(byte[] array, int off, int len)
byte
array to buffer.public FastByteBuffer append(byte[] array)
byte
array to buffer.public FastByteBuffer append(FastByteBuffer buff)
public int size()
public boolean isEmpty()
public void clear()
public byte[] toArray()
byte
array from buffered content.public byte[] toArray(int start, int len)
byte
subarray from buffered content.public byte get(int index)
byte
element at given index.Copyright © 2003-present Jodd Team