Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第二部分编解码器第11.4.1章节中代码清单 11-9中的代码有误,可能造成误导 #103

Open
SuMiaoALi opened this issue Mar 4, 2022 · 3 comments

Comments

@SuMiaoALi
Copy link

ByteBuf.slice(int index, int length)方法是从fromInex开始切割长度length的字节,而书中代码错误,当成了切割到endIndex位置,导致运行时出现IndexOutOfBoundsException异常,对初学者可能产生误导。

image

书中代码测试结果:

image

正确示例:

image

@gsonkeno
Copy link

gsonkeno commented Mar 4, 2022 via email

@He-Pin
Copy link
Member

He-Pin commented Apr 1, 2022

您好,这部分我回头看看,不好意思。

@He-Pin
Copy link
Member

He-Pin commented Sep 1, 2023

@SuMiaoALi 您好,请问方便发送个 PR吗,谢谢了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants