What type is the best to manage binary data in Java?

后端 未结 5 1468
时光说笑
时光说笑 2021-02-13 03:30

I\'m getting some documents from the web and many of them are binary files (executables, PDF, etc.). In Java, what is the correct type to hold the binary data until save it in d

5条回答
  •  太阳男子
    2021-02-13 04:27

    Use a byte[] or a ByteBuffer if you need simplified byte-level manipulation.

    Strictly speaking you could use a string but there are many pitfalls related to character encoding, so you shouldn't use strings without a really good reason to do so.

提交回复
热议问题