Java 为什么用以下方式初始化此缓冲区?
我可以在Java 为什么用以下方式初始化此缓冲区?,java,initialization,declaration,Java,Initialization,Declaration,我可以在javax.crypto.CipherInputStream(第77行)中看到以下初始化 Ȁ是什么意思?为什么缓冲区会以这种方式初始化?它是一个字符转换为int。此源代码中的值为512,此数组初始化为 /* the buffer holding data that have been read in from the underlying stream, but have not been processed by the cipher engine. the size 512
javax.crypto.CipherInputStream
(第77行)中看到以下初始化
Ȁ
是什么意思?为什么缓冲区会以这种方式初始化?它是一个字符
转换为int
。此源代码中的值为512,此数组初始化为
/* the buffer holding data that have been read in from the
underlying stream, but have not been processed by the cipher
engine. the size 512 bytes is somewhat randomly chosen */
private byte[] ibuffer = new byte[512];
512是字符“Ȁ”
的整数值,因此它是相同的初始化
Try:
System.out.println((char)512)代码>这是反编译器的一个问题,它们只查看字节码并尝试重建源代码
如果查看中的原始源,您将看到该行是原始的
private byte[] ibuffer = new byte[512];
“Ȁ”
的类型为char
,如果将其强制转换为int
,则其值为512。您的反编译器重建了一种可能的方式来生成字节码——但在这种情况下,没有一个理智的程序员会这样编写(除非打高尔夫球或故意混淆代码)。您使用什么反编译器?必须是private byte[]ibuffer=new byte[512]代码>你在哪里读到的?原始来源是512,当用char
表示时是“Ȁ”。很抱歉,我没有查找原始源代码。那么这可能是反编译器的问题,它以一种有趣的方式解释字节码。当然,这样写是有可能的(char会被转换成int),但没有一个头脑清醒的程序员会这样做(除非试图找到答案)。
private byte[] ibuffer = new byte[512];