List of usage examples for java.nio CharBuffer get
public CharBuffer get(char[] dest, int off, int len)
From source file:Main.java
public static void main(String[] args) { CharBuffer cb1 = CharBuffer.allocate(5); cb1.put(2, 'j'); cb1.rewind();/*from ww w . java 2s.c om*/ char[] charArray = new char[5]; cb1.get(charArray, 0, 2); System.out.println(Arrays.toString(charArray)); }
From source file:eu.stratosphere.types.StringValue.java
/** * Sets the contents of this string to the contents of the given <tt>CharBuffer</tt>. * The characters between the buffer's current position (inclusive) and the buffer's * limit (exclusive) will be stored in this string. * /*from ww w.j av a 2s. co m*/ * @param buffer The character buffer to read the characters from. */ public void setValue(CharBuffer buffer) { Validate.notNull(buffer); final int len = buffer.length(); ensureSize(len); buffer.get(this.value, 0, len); this.len = len; this.hashCode = 0; }