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