List of usage examples for java.nio CharBuffer reset
public final Buffer reset()
mark
. From source file:MainClass.java
public static void main(String[] argv) throws Exception { CharBuffer buffer = CharBuffer.wrap("01234567"); buffer.position(3).limit(6).mark().position(5); CharBuffer dupeBuffer = buffer.duplicate(); buffer.clear();/*from w w w . j ava 2s. c om*/ println(buffer); println(dupeBuffer); dupeBuffer.reset(); println(dupeBuffer); dupeBuffer.clear(); println(dupeBuffer); }
From source file:MainClass.java
private static void symmetricScramble(CharBuffer buffer) { while (buffer.hasRemaining()) { buffer.mark();/*from w w w. j a va 2 s .c o m*/ char c1 = buffer.get(); char c2 = buffer.get(); buffer.reset(); buffer.put(c2).put(c1); } }