CharBuffer: put(char c) : CharBuffer « java.nio « Java by API






CharBuffer: put(char c)

  
import java.nio.CharBuffer;

public class Main {
  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();
    cb2.rewind();
    System.out.println(cb1.limit(4).equals(cb2.limit(4)));
  }
}

   
    
  








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(String str)
13.CharBuffer: slice()
14.CharBuffer: subSequence(int start, int end)
15.CharBuffer: wrap(CharSequence csq)
16.CharBuffer: wrap(char[] array, int offset, int length)