static CharSequenceAdapter copy (CharSequenceAdapter other) { CharSequenceAdapter buf = new CharSequenceAdapter(other.sequence); buf.limit = other.limit; buf.position = other.position; buf.mark = other.mark; return buf; }
@Override public CharBuffer subSequence(int start, int end) { checkStartEndRemaining(start, end); CharSequenceAdapter result = copy(this); result.position = position + start; result.limit = position + end; return result; } }
public CharBuffer asReadOnlyBuffer () { return duplicate(); }
public final CharBuffer get (char[] dest, int off, int len) { int length = dest.length; if ((off < 0) || (len < 0) || (long)off + (long)len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferUnderflowException(); } int newPosition = position + len; sequence.toString().getChars(position, newPosition, dest, off); position = newPosition; return this; }
public CharBuffer duplicate () { return copy(this); }
@Override public char get(int index) { checkIndex(index); return sequence.charAt(index); }
public final CharBuffer get (char[] dest, int off, int len) { int length = dest.length; if ((off < 0) || (len < 0) || (long)off + (long)len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferUnderflowException(); } int newPosition = position + len; sequence.toString().getChars(position, newPosition, dest, off); position = newPosition; return this; }
public CharBuffer duplicate () { return copy(this); }
@Override public char get(int index) { checkIndex(index); return sequence.charAt(index); }
/** Returns a new readonly char buffer based on the specified char sequence. * * @param chseq The char sequence * @return A new readonly char buffer based on the specified char sequence. */ public static CharBuffer newCharBuffer (CharSequence chseq) { return new CharSequenceAdapter(chseq); }
@Override public CharBuffer subSequence(int start, int end) { checkStartEndRemaining(start, end); CharSequenceAdapter result = copy(this); result.position = position + start; result.limit = position + end; return result; } }
public final CharBuffer put (char[] src, int off, int len) { if ((off < 0) || (len < 0) || (long)off + (long)len > src.length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferOverflowException(); } throw new ReadOnlyBufferException(); }
public CharBuffer asReadOnlyBuffer () { return duplicate(); }
@Override public CharBuffer duplicate() { return copy(this); }
@Override public char get(int index) { checkIndex(index); return sequence.charAt(index); }
static CharSequenceAdapter copy (CharSequenceAdapter other) { CharSequenceAdapter buf = new CharSequenceAdapter(other.sequence); buf.limit = other.limit; buf.position = other.position; buf.mark = other.mark; return buf; }
@Override public CharBuffer subSequence(int start, int end) { checkStartEndRemaining(start, end); CharSequenceAdapter result = copy(this); result.position = position + start; result.limit = position + end; return result; } }