public class ByteBuffer extends Object
Constructor and Description |
---|
ByteBuffer(byte[] bytes)
Creates instance of ByteBuffer already filled by bytes.
|
ByteBuffer(int cacheSize)
Creates instance of ByteBuffer with byte array of required length.
|
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
append(byte c)
Appends byte to array if there are unfilled positions in it.
|
ByteBuffer |
append(byte[] bs,
int off,
int len)
Appends segment of a byte array to array if there are unfilled positions in it.
|
void |
compact() |
byte |
getByteAt(int index)
Returns byte at index.
|
byte[] |
getBytes()
Returns stored byte array.
|
int |
getCacheSize()
Returns capacity of this link.
|
ByteBuffer |
getLast() |
ByteBuffer |
getNext()
Returns the next link in the chain.
|
ByteBuffer |
getPrevious()
Returns the previous link in the chain.
|
int |
getTotalSize()
Returns total number of bytes stored in this link and all its predecessors.
|
int |
getUsedSize()
Returns actual number of byte stored in this link.
|
void |
reset()
Resets this byte buffer to empty state
|
void |
setNext(ByteBuffer b)
Sets the next link in the chain.
|
CharBuffer |
toCharBuffer()
Transforms this instance to instance of CharBuffer (a link of chain of char arrays).
|
CharBuffer |
toCharBuffer(String encoding)
Transforms this instance to instance of CharBuffer (a link of chain of char arrays).
|
public ByteBuffer(byte[] bytes)
bytes
- public ByteBuffer(int cacheSize)
cacheSize
- length of byte arraypublic ByteBuffer append(byte c)
c
- public ByteBuffer append(byte[] bs, int off, int len)
bs
- off
- len
- public byte[] getBytes()
public byte getByteAt(int index)
index
- public int getUsedSize()
public int getCacheSize()
public int getTotalSize()
public ByteBuffer getPrevious()
public ByteBuffer getNext()
public void setNext(ByteBuffer b)
b
- public CharBuffer toCharBuffer(String encoding) throws UnsupportedEncodingException
encoding
- UnsupportedEncodingException
public CharBuffer toCharBuffer()
public void reset()
public void compact()
public ByteBuffer getLast()
Copyright © 2016 JBoss by Red Hat. All Rights Reserved.