convert zip file to byte array

Ads
 

convert zip file to byte array

Hi,How to convert zip file to byte array,can you please provide program??

Thanks, Ramanuja

View Answers

May 25, 2012 at 12:16 AM

If you have a zip file on disk, get the size using java.io.File.length(), allocate a byte array "buffer" of that size, open the file with FileInputStream, call read(buffer), close the FileInputStream.

If you have a byte array, open the file with a FileOutputStream, call write(byteArray), close the FileOutputStream.

Ads









Related Tutorials/Questions & Answers:
convert zip file to byte array
convert zip file to byte array  Hi,How to convert zip file to byte array,can you please provide program?? Thanks, Ramanuja
Java convert file to byte array
Java convert file to byte array  How to convert file to byte array in Java? Thanks   Hi, To convert file to byte array in Java you have... a File into a Byte Array Thanks
Advertisements
how to create a zip by using byte array
how to create a zip by using byte array  hi, How to convert byte array to zip by using java program.can u plz provide it...... Thanks, krishna
convert a file .doc to .zip
convert a file .doc to .zip  hiii, I uploaded a file with extension .doc now i required with .zip   Hi Friend, Try the following code... + ".zip"; byte[] buffer = new byte[18024]; try{ ZipOutputStream zos
Convert a string representation of a hex dump to a byte array using Java?
Convert a string representation of a hex dump to a byte array using Java?  Convert a string representation of a hex dump to a byte array using Java
Java example for Reading file into byte array
into a Byte Array Reading File into ByteArray Convert...Java example for Reading file into byte array. You can then process the byte... in Java for reading file into byte array. Sometimes it becomes necessary
Java file to byte array
Java file to byte array In this section, you will learn how to reads the entire content of a file into a byte array.  Description of code: We have created an instance of InputStream class that takes the file. The byte array hold
Java read file contents into byte array
Java read file contents into byte array  Hello share the code of java read file contents into byte array with me. It's urgent. Thanks   Hi... at : Java example for Reading file into byte array Thanks
Java get byte array from file
Java get byte array from file  what is the code example in Java for getting byte array from file in memory. Thanks   This is very simple... example for Reading file into byte array Reading a File into a Byte Array Thanks
Read file into byte array java code eample
Read file into byte array java code eample  Hi, I have a project where I have to write for that reads file into byte array. I want a code java code for reading file into byte. Just let's know the best code. Thanks   
How to convert java BigDecimal to normal byte array not 2 s complement
How to convert java BigDecimal to normal byte array not 2 s complement  How to convert java BigDecimal to normal byte array not 2 s complement
Java read entire file into byte array
Java read entire file into byte array  Where is the example of Java read entire file into byte array on your website? Thanks   Hi, Its... complete example at Reading file into bytearrayoutputstream Thanks
Reading binary file into byte array in Java
Example code of reading binary file into byte array in Java This example shows you how to read a binary file into byte array from Java program. This type... and use the byte array data for further processing. To the binary file into byte
conver byte array to ByteArrayOutputStream
conver byte array to ByteArrayOutputStream  Sir Can you please tell me how to convert the byte[] to ByteArrayOutputStream; One of my method will return the byte[] , i have to convert this byte array to ByteArrayOutputStream
Java file byte reader
example for Reading file into byte array Reading a File into a Byte Array...Java file byte reader  I am looking for an example program in Java for reading the bytes. More specifically I need java file byte reader example code
How to convert string to byte in Java
How to convert string to byte in Java  How to convert string to byte in Java
Byte array to PDF Conversion
Byte array to PDF Conversion  Hi, Am getting a letter Format in Byte array and i have to display that in PDF.Is that possible in PHP ? If so please let me knw how should i ? I can able to display that in a word Document but i
How to convert multiple files in java to .zip format
How to convert multiple files in java to .zip format  i receive...); } i want to convert the data from inputStream into Zip Stream and so...; protected void createZip(File zipFile, File[] listFiles) { try { byte b
sending a zip file to servlet
sending a zip file to servlet  I have created a .zip file in a servlet on the local system(no static ip). The .zip file contains xml files. I have to send it to another servlet which is in a server(has a static ip). I have done
How to Convert ArrayList to Array?
How to Convert ArrayList to Array?  Hi, I am trying to learn to Convert ArrayList to Array. How it is possible? How to Convert ArrayList to Array? Thanks   Hi, To Convert ArrayList to array ArrayList.toArray
How do I initialize a byte array in Java?
How do I initialize a byte array in Java?  How do I initialize a byte array in Java
How to zip a file using javascrip?
How to zip a file using javascrip?  hi.. can anyone tell me How to zip a file using javascrip
Read file zip in J2ME - MobileApplications
Read file zip in J2ME  I would like to read file.zip in J2ME,I don't know how to extract it. Please help me
find zip file length lessthen 5MB
find zip file length lessthen 5MB  import java.io.BufferedReader... = folder.listFiles(); File zipedfile=new File(detination); byte...(); } else{ System.out.println("zip file
Issue in Converting .zip file to .jar file?
Issue in Converting .zip file to .jar file?  I have a folder called "printpdf.jar". I have changed the .jar to .zip and did some customizations. After which i had "zipped" it again and made as ".jar". Now the final file
How to convert Collection to Array in Java?
How to convert Collection to Array in Java?  Hello, I have a collection object in data with data in it. How to convert Collection to Array in Java...("This "); Above code create a collection and then add an item to it. Now to convert
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
how to convert .xml file to csv file
how to convert .xml file to csv file  how to convert .xml file to csv file
Convert Text File to PDF file
Convert Text File to PDF file  Here is the way how to covert your Text file to PDF File, public class TextFileToPDF { private static void... BufferedReader(new FileReader( "**INPUT FILE**")); String inLine
How to convert XML file to database ?
How to convert XML file to database ?  How to convert XML file to database
Convert Array to Vector
Convert Array to Vector       In this section, you will learn to convert an Array to Vector.  Code Description: This program helps you in converting an Array

Ads