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 你好


目录
相关文章
13avalon - 指令ms-skip (skip绑定)
13avalon - 指令ms-skip (skip绑定)
61 0
|
5月前
|
开发工具 git
7-5git reset --hard origin/master代表什么意思
7-5git reset --hard origin/master代表什么意思
|
6月前
|
API 计算机视觉
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
|
6月前
|
PHP 开发工具 git
BUU [BJDCTF2020]Mark loves cat
BUU [BJDCTF2020]Mark loves cat
63 0
|
Linux 开发工具 Android开发
[√]leak tracer的stack address始终无法被addr2line识别
[√]leak tracer的stack address始终无法被addr2line识别
171 0
|
测试技术
Pytest-mark标记的其他方法
Pytest-mark标记的其他方法
59 0
|
SQL 安全 Dubbo
mark好文章
mark好文章
85 0
|
数据安全/隐私保护
SmartSVN无法提交的解决办法:because it was moved from which is not part of the commit; both sides of the move
SmartSVN无法提交的解决办法:because it was moved from which is not part of the commit; both sides of the move
435 0
|
Oracle 关系型数据库 数据库
大年初一mark一下
新的一年将会下线个人ORACLE外文blog,精力有限,会全力在阿里云云栖社区分享,主要内容还是数据库相关,包括但不限于以下内容: ORACLE数据库性能分析 PostgreSQL数据库全栈支持 PPAS数据库全栈支持 专注ORACLE数据库和应用迁移至阿里云PPAS、PostgreSQL等数据...
1453 0