2016-01-10 83 views
0

我有我想要寫入文件的十六進制數據塊,因爲它是。將十六進制數據寫入文件原樣?

000100050000470040002E000000000099009900500000000000490067008D0000000000890081007600000000004C002F0027000000000200050000470040002E0000000000000D00590065006C006C006F00770020006F006C0069007600650000000099009900500000000000000D004F006C006900760065002000790065006C006C006F007700000000490067008D0000000000000D00440069007300740061006E007400200062006C00750065000000008900810076000000000000110050006500610072006C0020006D006F00750073006500200067007200650079000000004C002F00270000000000000F004D00610068006F00670061006E0079002000620072006F0077006E0000

上述嵌段表示的Adobe .aco(存儲調色板)文件。

類似的文件在十六進制編輯器顯示打開: -

enter image description here

在嘗試使用

代碼

try { 
    File ACO = new File(f.getAbsolutePath(),"NameRandom.aco"); 
    ACO.createNewFile(); 

    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(ACO))); 
    try { 
     writer.write(<-- Above Block -->); 
    } finally { 
     writer.close(); 
    } 
} catch (IOException e) { 
    e.printStackTrace(); 
} 

寫出給定塊,但上面的代碼顯示了在不同hed Editor(如下圖)

enter image description here

我想寫入給定的塊,因爲它在文件中的當前狀態。

回答

相關問題