List of usage examples for java.nio CharBuffer allocate
public static CharBuffer allocate(int capacity)
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.put('j').put('a').put('v').put('a').put('2').put('s'); ;/*from ww w . ja v a2 s . co m*/ cb1.rewind(); System.out.println(cb1.toString()); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5), cb2 = CharBuffer.allocate(5); cb1.put('B').put('u').put('f').put('f').put('A'); cb2.put('B').put('u').put('f').put('f').put('B'); cb1.rewind();//from www .j a va 2 s . c om cb2.rewind(); System.out.println(cb1.limit(4).equals(cb2.limit(4))); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.put(new char[] { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm', }); cb1.rewind();/*from w ww . jav a2 s .c om*/ CharBuffer cb2 = CharBuffer.allocate(5); cb2.put(cb1); System.out.println(cb2.toString()); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.put(2, 'j'); cb1.rewind();//ww w. ja v a2s . com System.out.println(cb1.get()); System.out.println(cb1.get()); System.out.println(cb1.get()); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.put(2, 'j'); cb1.rewind();/*from w ww .j a v a 2 s .c o m*/ System.out.println(Arrays.toString(cb1.array())); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.append("java2s.com", 0, 4); cb1.rewind();/*from w w w .ja va 2 s . c om*/ System.out.println(Arrays.toString(cb1.array())); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(50); cb1.append("java2s.com"); cb1.rewind();//from w w w. j av a2 s. c o m System.out.println(Arrays.toString(cb1.array())); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.append('j'); cb1.rewind();/*from ww w. ja v a 2s . co m*/ System.out.println(Arrays.toString(cb1.array())); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(50); cb1.append("java2s.com"); cb1.rewind();/* w w w . j av a 2 s .co m*/ System.out.println(cb1.charAt(2)); System.out.println(Arrays.toString(cb1.array())); }
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(50); cb1.append("java2s.com"); cb1.rewind();//w w w . j ava2s .c o m System.out.println(cb1.arrayOffset()); System.out.println(Arrays.toString(cb1.array())); }