How to output binary data to a file in Java?

前端 未结 2 1280
广开言路
广开言路 2020-12-14 02:37

I\'m trying to write data to a file in binary format for compression. The data consists entirely of floating points so I decided to quantize the data to an intergers between

2条回答
  •  天涯浪人
    2020-12-14 03:22

    Maybe this fragment will help.

     int i = 42;
     DataOutputStream os = new DataOutputStream(new FileOutputStream("C:\\binout.dat"));
     os.writeInt(i);
     os.close();
    

提交回复
热议问题