CharBuffer: subSequence(int start, int end) : CharBuffer « java.nio « Java by API






CharBuffer: subSequence(int start, int end)

 

import java.nio.ByteBuffer;
import java.nio.CharBuffer;

public class Main {
  public static void main(String[] argv) throws Exception {
    ByteBuffer buf = ByteBuffer.allocate(100);

    CharBuffer cbuf = buf.asCharBuffer();

    cbuf.put("a string");

    int start = 2; // start is relative to cbuf's current position
    int end = 5;
    CharSequence sub = cbuf.subSequence(start, end); // str

  }
}

   
  








Related examples in the same category

1.CharBuffer: allocate(int capacity)
2.CharBuffer: array()
3.CharBuffer: arrayOffset()
4.CharBuffer: capacity()
5.CharBuffer: flip()
6.CharBuffer: get()
7.CharBuffer: hasArray()
8.CharBuffer: hasRemaining()
9.CharBuffer: limit()
10.CharBuffer: limit(int newLimit)
11.CharBuffer: position()
12.CharBuffer: put(char c)
13.CharBuffer: put(String str)
14.CharBuffer: slice()
15.CharBuffer: wrap(CharSequence csq)
16.CharBuffer: wrap(char[] array, int offset, int length)