This class wraps a byte buffer to be a char buffer.
Method from java.nio.CharToByteBufferAdapter Detail: |
public void addressValidityCheck() {
if (byteBuffer instanceof DirectBuffer) {
((DirectBuffer) byteBuffer).addressValidityCheck();
} else {
assert false : byteBuffer;
}
}
|
public CharBuffer asReadOnlyBuffer() {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer
.asReadOnlyBuffer());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
|
public CharBuffer compact() {
if (byteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
byteBuffer.limit(limit < < 1);
byteBuffer.position(position < < 1);
byteBuffer.compact();
byteBuffer.clear();
position = limit - position;
limit = capacity;
mark = UNSET_MARK;
return this;
}
|
public CharBuffer duplicate() {
CharToByteBufferAdapter buf = new CharToByteBufferAdapter(byteBuffer
.duplicate());
buf.limit = limit;
buf.position = position;
buf.mark = mark;
return buf;
}
|
public void free() {
if (byteBuffer instanceof DirectBuffer) {
((DirectBuffer) byteBuffer).free();
} else {
assert false : byteBuffer;
}
}
|
public char get() {
if (position == limit) {
throw new BufferUnderflowException();
}
return byteBuffer.getChar(position++ < < 1);
}
|
public char get(int index) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return byteBuffer.getChar(index < < 1);
}
|
public PlatformAddress getBaseAddress() {
if (byteBuffer instanceof DirectBuffer) {
return ((DirectBuffer) byteBuffer).getBaseAddress();
}
assert false : byteBuffer;
return null;
}
|
public int getByteCapacity() {
if (byteBuffer instanceof DirectBuffer) {
return ((DirectBuffer) byteBuffer).getByteCapacity();
}
assert false : byteBuffer;
return -1;
}
|
public PlatformAddress getEffectiveAddress() {
if (byteBuffer instanceof DirectBuffer) {
return ((DirectBuffer) byteBuffer).getEffectiveAddress();
}
assert false : byteBuffer;
return null;
}
|
public boolean isAddressValid() {
if (byteBuffer instanceof DirectBuffer) {
return ((DirectBuffer) byteBuffer).isAddressValid();
}
assert false : byteBuffer;
return false;
}
|
public boolean isDirect() {
return byteBuffer.isDirect();
}
|
public boolean isReadOnly() {
return byteBuffer.isReadOnly();
}
|
public ByteOrder order() {
return byteBuffer.order();
}
|
protected char[] protectedArray() {
throw new UnsupportedOperationException();
}
|
protected int protectedArrayOffset() {
throw new UnsupportedOperationException();
}
|
protected boolean protectedHasArray() {
return false;
}
|
public CharBuffer put(char c) {
if (position == limit) {
throw new BufferOverflowException();
}
byteBuffer.putChar(position++ < < 1, c);
return this;
}
|
public CharBuffer put(int index,
char c) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
byteBuffer.putChar(index < < 1, c);
return this;
}
|
public CharBuffer slice() {
byteBuffer.limit(limit < < 1);
byteBuffer.position(position < < 1);
CharBuffer result = new CharToByteBufferAdapter(byteBuffer.slice());
byteBuffer.clear();
return result;
}
|
public CharSequence subSequence(int start,
int end) {
if (start < 0 || end < start || end > remaining()) {
throw new IndexOutOfBoundsException();
}
CharBuffer result = duplicate();
result.limit(position + end);
result.position(position + start);
return result;
}
|
static CharBuffer wrap(ByteBuffer byteBuffer) {
return new CharToByteBufferAdapter(byteBuffer.slice());
}
|