List of utility methods to do CharBuffer
void | printCharBuffer(CharBuffer msg) print Char Buffer System.out.println("---------------------------------------------------------------------------- \n" + msg + "\n----------------------------------------------------------------------------"); |
CharBuffer | put(char c, CharBuffer buffer) Add the character to the buffer, extending the buffer if needed CharBuffer localBuf = buffer; if (capacityRemaining(buffer) < 1) { localBuf = extendBuffer(buffer, BLOCK_SIZE); localBuf.put(c); return localBuf; |
int | searchNewline(CharBuffer buffer, int from) Scan for a newline sequence in the given CharBuffer, starting at position from until buffer.position(). int to = buffer.position(); if (from >= to) { return -1; char[] chars = buffer.array(); for (int i = from; i < to; i++) { if (chars[i] == '\n' || (chars[i] == '\r' && i < to - 1)) { return i; ... |
Boolean | startsWith(final CharBuffer charBuffer, final String token) starts With charBuffer.mark(); try { for (int i = 0; i < token.length(); i++) { if (!charBuffer.hasRemaining()) { return false; final char cb = charBuffer.get(); final char ct = token.charAt(i); ... |
char[] | toCharArray(CharBuffer charBuffer) to Char Array char[] chars = new char[charBuffer.remaining()]; charBuffer.get(chars); return chars; |
CharBuffer | toCharBuffer(int[] codePoints) to Char Buffer final char[] chars = new char[codePoints.length * 2]; int i = 0; for (int cp : codePoints) { i += Character.toChars(cp, chars, i); return CharBuffer.wrap(chars, 0, i); |
void | zeroCharBuffer(CharBuffer buf) zero Char Buffer Arrays.fill(buf.array(), buf.arrayOffset(), buf.arrayOffset() + buf.limit(), (char) 0);
|