How to convert bytes to file : JAVA Code

File file_1=new File("c://users//tobo//output.zip");
try
{
byte[] bytes = Base64.getDecoder().decode(contentByte);
Files.write(file2.toPath(), bytes);
}
catch(Exception oe)
{
oe.printStackTrace();
System.out.println("File could not be Written in zip format);

}
ContentInBytes is a string in the code above holding the file data.
bytes is a variable which holds the file into bytes. 
File_1 is a variable where path of the final output file will be saved.

4 thoughts on “How to convert bytes to file : JAVA Code

  1. I think the admin of this website is genuinely working
    hard in support of his web site, since here every material is quality based information.

  2. Hola! I’ve been following your web site for some time now and
    finally got the courage to go ahead and give you a shout out from Austin Tx!
    Just wanted to say keep up the fantastic job!

  3. Appreciating the persistence you put into your
    blog and in depth information you offer. It’s awesome to come across
    a blog every once in a while that isn’t the same old
    rehashed material. Fantastic read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

Leave a Reply to j.mp Cancel reply

Your email address will not be published.

Verified by MonsterInsights