Home Discussion Discuss: Zip File Using Java

  • java ioamol June 12, 2011 at 5:24 PM

    please explain java io

  • unknownshawn June 27, 2011 at 8:49 AM

    hi hope it works

  • Simple codeNishanth Thomas December 1, 2011 at 11:50 AM

    import java.io.*; import java.util.zip.*; public class ZipCreateExample{ /** * @param args the command line arguments * @throws FileNotFoundException */ public static void main(String[] args) throws Exception { // input file FileInputStream in = new FileInputStream("F:/Documents and Settings/nishanth1125/Desktop/ZipCreateExample.java");; // out put file ZipOutputStream out = new ZipOutputStream(new FileOutputStream("F:/Documents and Settings/nishanth1125/Desktop/tmp.zip")); // name of file out.putNextEntry(new ZipEntry("zippedjava.java")); byte[] b = new byte[1024]; int count; while ((count = in.read(b)) > 0) { System.out.println(); // write file in zip out.write(b, 0, count); } out.close(); in.close(); } }

  • Zipping a Filemohit July 17, 2012 at 1:43 PM

    Instead of zipping a file, i want to zip a folder present on some location on my p.c (i.e D:\\java\pics) Is it possible? Any code-snippet will highly be appreciated.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java Interview Questions

File
File   How to find all files in our local computer using java 

Java Beginners

Excel file wriring using java
Excel file wriring using java  i have one predefined bill format in excel i want to append values in it using java apche POI or Jexcel i tried it but it overwrites file and lost previous contents what can i do 

Java Beginners

excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using 

Java Beginners

xml file reading using java
xml file reading using java  hi deepak I want to read some data from xml file and send that output to particular email address using java   import org.w3c.dom.*; import org.w3c.dom.Node; import javax.xml.parsers. 

JSP Interview Questions

file upload using JSP
file upload using JSP  I have created a form to upload a file in a html page, now i want to get the path of the file in a jsp page so what code...="java" %> <HTML> <HEAD><TITLE>Display file upload form 

JSP Servlet Questions

file uploading using jsp
file uploading using jsp  below file uploading code has one error... = " + formDataLength); //String file = new String(dataBytes); //out.println("FileContents:" + file +""); byte[] line = new byte[128]; if (totalBytesRead 

Java Beginners

How to open a file in java using JFileChooser
How to open a file in java using JFileChooser  How to open a file in java using JFileChooser 

Development process Questions

How to transfer a file in java using SSH & Telnet
How to transfer a file in java using SSH & Telnet  How to transfer a file in java using SSH & Telnet 

Java Magazine Questions

parsing xml file using java code
parsing xml file using java code  parsing a xml file using java code 

Java Beginners

how to create an excel file using java
how to create an excel file using java  how to create an excel file using java 

Java Beginners

edit msword file - using java - Java Beginners
edit msword file - using java  I want to edit ms word file. That is input file font style is times new romen and font size is 12. I want the output file font style is bookman old style and size is 20. How to possible java 

Java Interview Questions

Reading .doc file using swing
Reading .doc file using swing  Sir, Could U Please Tell me the Way To Read .doc file in java using swing,with code 

Java Beginners

inserting text into text file using java application
inserting text into text file using java application  Hi, I want to insert a text or string into a text file using java application 

Java Beginners

Remote file transfer in java using SSH & Telnet
Remote file transfer in java using SSH & Telnet  How to upload & download a file in java using SSH & Telnet 

Java Tips and Examples

Unzip File Using Java
using java. The java.util.zip.ZipEntry class is used to represent a zip file... interface. Here we passing the zipped file name to be unzipped using command line... Unzipping a File      

Java Beginners

how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response 

Java Beginners

how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response 

Java Beginners

How to write to file using FileOutputStream
How to write to file using FileOutputStream  Hi friends, Please help me in java program. How to write to file using FileOutputStream? thanks,   Hi, To write a file using FileOutputStream, we have to use 

Java Beginners

How to write to file using FileWriter
How to write to file using FileWriter  hi, How to write to file using FileWriter thanks,   Hi, To writing in a file in Java program we... of the FileWriter class can be created using the following of its constructor i.e. FileWriter 

Java Beginners

how to upload file using FTP in java
how to upload file using FTP in java  hai, i want to upload file using FTP in java Webservices.. Tel me some Articles Regards Asha 

Java Beginners

how to read and write an xml file using java
how to read and write an xml file using java  Hi Can anyone help me how to read and write an xml file which has CData using java 

XML Questions

How to Split a large XML file using java?
How to Split a large XML file using java?  How can we split a 500MB Xml file?I know how to split xml file after reading the entire document in a file.Here we cannot load the entire file as it is a large file 

Spring Framework Questions

downloading excel file using Java and springs
downloading excel file using Java and springs  I need to find out how to download an excel file using the spring framework in java. Please help me out as I am new to springs and its urgent 

Applet Questions

Play SWF file using Java - Applet
Play SWF file using Java  Hi I have task to design a screen saver using java. Now, I want to play .SWF (Flash file)in my Applet. Is there any way to play SWF from java class. Any reply will be appreciated. Thanks 

Java Beginners

Reading RDF file using Java code in Eclipse
Reading RDF file using Java code in Eclipse  Could you please tel me what this statement means - Model model = ModelFactory.createDefaultModel 

Java Beginners

Fetching the exact data from file using java
Fetching the exact data from file using java  **hi ... i am having one .lst file.. that file consists of instructions and opcodes.. now i want to fetch only the opcode from that file.. could u pls anyone guide me this using java 

Java Beginners

To read & write a excel file using the core java
To read & write a excel file using the core java  Hai, I'm new to JavaProgram.But now i need java program to read & write a excel file so, can anyone help me to learn the above mentioned topic(link for the portion 

JSP Servlet Questions

form field mapping with pdf file using java
form field mapping with pdf file using java   Hai all, I have one... file. means, if click on text field according that perticular field .the data related to the field in pdf file should marked with a color. can any one give 

Java Beginners

downloading a file directly from mysql using java
downloading a file directly from mysql using java  Hi, I am trying to come up with a code to download a file that is on a mysql database (in form of a blob) without using url. Can anyone tell me how it can be done because I am 

Java Beginners

String file in to word file in java
String file in to word file in java  how to convert a String format word file into Ms Word file using java? please can anyone of you help me 

DMCA.com