List of usage examples for java.nio CharBuffer arrayOffset
public final int arrayOffset()
From source file:MainClass.java
public static void main(String argv[]) { ByteBuffer bb = ByteBuffer.allocate(100); bb.mark();// w w w . j a v a 2 s . com bb.position(5); bb.reset(); bb.mark().position(5).reset(); char[] myBuffer = new char[100]; CharBuffer cb = CharBuffer.wrap(myBuffer); cb.position(12).limit(21); CharBuffer sliced = cb.slice(); System.out.println("Sliced: offset=" + sliced.arrayOffset() + ", capacity=" + sliced.capacity()); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(50); cb1.append("java2s.com"); cb1.rewind();/*from ww w. j a v a 2s . c o m*/ System.out.println(cb1.arrayOffset()); System.out.println(Arrays.toString(cb1.array())); }
From source file:MainClass.java
private static void println(CharBuffer cb) { System.out.println("pos=" + cb.position() + ", limit=" + cb.limit() + ", capacity=" + cb.capacity() + ", arrayOffset=" + cb.arrayOffset()); }