Java: File to Hex?

后端 未结 4 1528
别跟我提以往
别跟我提以往 2020-12-16 19:37

I have a file in Java

FileInputStream in = null;
try{    
in = new FileInputStream(\"C:\\\\pic.bmp\");
}catch{}

I want to convert pic.b

4条回答
  •  长情又很酷
    2020-12-16 20:28

    If you want to fiddle with the bytes yourself, get a FileChannel from the FileInputStream, and then allocate a ByteBuffer and then read all the content into it. ByteBuffer also has methods to deal with larger chunks of bytes, in the two different byte orders.

提交回复
热议问题