Java: Need to create PDF from byte-Array

后端 未结 4 1865
逝去的感伤
逝去的感伤 2021-02-02 13:20

From a DB2 table I\'ve got blob which I\'m converting to a byte array so I can work with it. I need to take the byte array and create a PDF out of it.

This

4条回答
  •  鱼传尺愫
    2021-02-02 14:15

    Sending your output through a FileWriter is corrupting it because the data is bytes, and FileWriters are for writing characters. All you need is:

    OutputStream out = new FileOutputStream("out.pdf");
    out.write(bArray);
    out.close();
    

提交回复
热议问题