• 0

[Java] Copying Files / Writing Files


Question

Hello...

If I have an input stream of a file as a byte array or a string, how would I go about writing this file to my pc? I have tried

BufferedOutputStream fileWriter = new BufferedOutputStream(new FileOutputStream(new File("c:\\Files\"+filename)));
fileWriter.write(stream info here)

But all i get is a file with the right length and name but nothing in it, or no image to see...

What am i missing?

Thanks

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I already have the information in a String/byte array but my problem is that the information is for example of an image... not a .txt file. My question is how can I write data for the different data types? it is not enough to place them as if they are a .txt file and change the file extension

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.