mark 和 reset

简介: mark 和 reset

mark 是在读取时,做一个标记,即使 position 改变,只要调用 reset 就能回到 mark 的位置

注意

rewind 和 flip 都会清除 mark 位置

字符串与 ByteBuffer 互转

ByteBuffer buffer1 = StandardCharsets.UTF_8.encode("你好"); ByteBuffer buffer2 = Charset.forName("utf-8").encode("你好");

debug(buffer1); debug(buffer2);

CharBuffer buffer3 = StandardCharsets.UTF_8.decode(buffer1); System.out.println(buffer3.getClass()); System.out.println(buffer3.toString());

结果 +-------------------------------------------------+ |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f | +--------+-------------------------------------------------+----------------+ |00000000| e4 bd a0 e5 a5 bd                               |......          | +--------+-------------------------------------------------+----------------+ +-------------------------------------------------+ |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f | +--------+-------------------------------------------------+----------------+ |00000000| e4 bd a0 e5 a5 bd                               |......          | +--------+-------------------------------------------------+----------------+ class java.nio.HeapCharBuffer 你好


相关文章
Using ‘value‘ pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value s
本文讨论了OpenCV中使用`createTrackbar`时遇到的"Using ‘value’ pointer is unsafe and deprecated"警告,并提供了通过设置空指针或使用回调函数来解决这个问题的方法。
Using ‘value‘ pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value s
解决Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
996 0
解决Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
大年初一mark一下
新的一年将会下线个人ORACLE外文blog,精力有限,会全力在阿里云云栖社区分享,主要内容还是数据库相关,包括但不限于以下内容: ORACLE数据库性能分析 PostgreSQL数据库全栈支持 PPAS数据库全栈支持 专注ORACLE数据库和应用迁移至阿里云PPAS、PostgreSQL等数据...
1462 0
[20171123]Skip Locked and ITL slot 2.txt
[20171123]Skip Locked and ITL slot 2.txt --//昨天看链接提到Skip Locked and ITL slot相关问题,链接 http://jonathanlewis.
1110 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等