@Test
public void testWrite() throws IOException {
File file = new File("/home/my.test");
file.createNewFile();
int b = 0x1B, a = 0x78, c = 0x6f, d = 0x3f;
FileOutputStream fos = new FileOutputStream(file);
fos.write(a);
fos.write(b);
fos.write(c);
fos.write(d);
fos.close();
}
如图和代码,我只是想写入四个十六进制的数值进去,并且在 vim 下用%!xxd 下能看到的十六进制的数值只有 4 个。但实际上我看到的却有五个,多了一个0a,这是啥特殊情况呢?求教!