Reading a binary file in Java

前端 未结 2 1822
故里飘歌
故里飘歌 2021-01-04 11:50

I have a comparatively long file of unsigned integers (64 bits each, 0.47GB file) that I need to read and store in an array. After some brain racking I wound up using the ty

相关标签:
2条回答
  • 2021-01-04 12:34

    You should use buffered input, something like:

    new DataInputStream(
        new BufferedInputStream(
            new FileInputStream(new File(input_file))))
    
    0 讨论(0)
  • 2021-01-04 12:45

    Want to object of the file:

    new ObjectInputStream(
        new BufferedInputStream(
            new FileInputStream(new File(file_name))))
    

    More about difference

    0 讨论(0)
提交回复
热议问题