calling zipping function 1 Answer(s) 4 years and 3 months ago
Posted in : JSP-Servlet
View Answers
April 7, 2009 at 12:14 PM
Hi friend,
Code to help in solving the problem :
import java.io.*; import java.util.zip.*;
public class ZipCreateFile{ public static void main(String[] args) throws IOException{ System.out.print("Please enter file name to zip : ");
BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); //String filesToZip = input.readLine(); String filesToZip = "C:\\apache-tomcat-6.0.13\\webapps\\ROOT\\showname.jsp"; File f = new File(filesToZip); if(!f.exists()){ System.out.println("File not found."); System.exit(0); } System.out.print("Please enter zip file name : "); String zipFileName = input.readLine(); if (!zipFileName.endsWith(".zip")) zipFileName = zipFileName + ".zip"; byte[] buffer = new byte[18024]; try{ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName)); out.setLevel(Deflater.DEFAULT_COMPRESSION); FileInputStream in = new FileInputStream(filesToZip); out.putNextEntry(new ZipEntry(filesToZip)); int len; while ((len = in.read(buffer)) > 0){ out.write(buffer, 0, len); } out.closeEntry(); in.close(); out.close(); } catch (IllegalArgumentException iae){ iae.printStackTrace(); System.exit(0); } catch (FileNotFoundException fnfe){ fnfe.printStackTrace(); System.exit(0); } catch (IOException ioe){ ioe.printStackTrace(); System.exit(0); } } }
Thanks
Related Pages:
calling zipping function - JSP-Servlet callingzipping function Hi,
Is it possible to zip a jsp file. I wrote a java function for zipping a file.How to call that java file (zippingfunction
) in JSP ? pls help me
Thanks.... 
Calling a function Calling a function Hi, I have a function xyz() in php code. When a button is clicked it should execute that particular function for that i have... functionfunction xyz()
{
}
but this is not working
can u tell me
calling function - JSP-Servlet calling function Hai,
How to call a java file in jsp file? Hi friend,
Step to be remember for solving the problem :
1.Create a jsp page "test.jsp"
Example of Extends
Attribute of page
From struts calling function to bean - EJB
From struts callingfunction to bean
I am calling a function from "struts action class" to bean. I am using weblogic 8.1 web server.i am able to call the function from action class,when i restart the server.But when i
Zipping folder - Java Beginners Zipping folder sir, as the part of my academic project, i need... it successfully,,and i tried some recursive method of the same for zipping... solve this.. zipping folder and all of its files and sub folders.
thanking
calling setInterval() on onclick event calling setInterval() on onclick event Hi all,
I am trying...;
var xmlHttp;
function postRequest...);
}
function stateChange
Zipping folder - Java Beginners Zipping folder sir, as the part of my academic project, i need... it successfully,,and i tried some recursive method of the same for zipping... solve this.. zipping folder and all of its files and sub folders.
thanking
Calling Flex Function From JavaScript
;
}
.style4 {
border-style: solid;
border-width: 1px;
}
Calling Flex Function From JavaScript
Sometimes, you may need to call flex function from JavaScript... function
using addCallback() function of ExternalInterface to make the flex
Calling Namespace Calling Namespaced Code From Other File:
In the previous tutorial we have seen that how to declare a namespace and how
to access the class, function from... class and function from other file.
Example:
Lib1.php
<?php
Calling Anonymous JavaScript Function From Flex
: #FFFFCC;
}
Calling Anonymous JavaScript Function From Flex
In flex
application, you can call javascript function defined in html file where
your flex file is embed. But you can also call an anomymous javascript function
calling servlet from JS and return response from servlet to JS
page when user clicks on a button i am calling a javascript function(eg myFunc...calling servlet from JS and return response from servlet to JS hello...) to the function myFunc and the myFunc will load that file(url) on the same webpage using
video calling
video calling how to implement video calling using java? i am a final year mca student please give me some samplecodes
video calling
video calling how to implement video calling using java? i am a final year mca student please give me some samplecodes
ejb calling from jsf - Java Server Faces Questions
ejb calling from jsf 1st i take list of person then i try to edit one of them and then again pass to the ejb to merge it.
the ejb function... null;
}
when it comes to call the function i get the exception
Append Function in Java
Append Function in Java What is the use of append function in java? How to use the append function to append a string to a buffer string.
Thanks... through calling the toString() on the StringBufferobject.
Use StringBuffer is very
Calling Destructor Calling Destructor How can i call destructor in java using System.gc() or manually. Please anyone give me a example program
Java is a garbage collected language therefore you cannot predict when (or even
PHP Function
to the calling portion.
One function can be called number of times, and one function can... manageable, robust.
A general format of the function in PHP is as follows:
function <function name> (<list of parameters>)
With the help
function
function difference between function overloading and operator overloading
bsearch() function in C
of the specified array to the key by calling the function comp(). This function...bsearch() function in C Programming Language
This section demonstrates the use bsearch() function in C. This searches function the given key in the array
call a function - Java Interview Questions
},
};
//calling the function union : paramtere to pass is mat
//how i...call a function Please i want to call the function union via main
How I can do it???
Here you find my code
With my best Regards
php calling variables
php calling variables Can i call a member variable of a class using static method in php
Understanding public static void main function
Understanding public static void main function
The public static void main function is important
function in Java programming language. In this section we will learn about main
Calling from JSP Calling from JSP how can we call a class file from JSP
Hi,
Do you want to call a servlet or a Java Bean through JSP?
Please clarify this.
For more information, visit the following link:
JSP Tutorials
Thanks
PHP Function Arguments
the function return control/value to the callingfunction.
In general we pass...
$a=14;
$b=34;
echo "Before calling the
function:<br/>"... "<br/>After calling
the function:<br/>";
echo"
Calling servlet from servlet . Calling servlet from servlet . How to call a servlet from another... ServletException, IOException {
System.out.println("Calling another servlet by using...);
System.out.println("Calling another servlet by using SendRedirect
calling method - Java Beginners calling method class A{
public void fo(){
class B{
public void fo1(){
System.out.println("fo1 of class B");
}
}
System.out.println("fo of class A");
}
class C{
public void fo2
PHP User Defined Function
($array);
?>
Output:
Before calling string_push function
array(3...PHP User Defined Function
An user-defined function saves us from ...
functions as per the need. General structure of the user defined function
jQuery To callback tabs
;
In this JQuery tutorial we will develop a
program to callingfunction...;
function divHide(){
document.getElementById("dispfunc").style.display='none';
}
$(function() {
$('#div-1').tabs
Calling Constructor in Spring Calling Constructor in Spring
In the given example you will be learning about a
constructor and how to call a constructor in the Spring. Declaring constructor injection
Server calling of .exe file in the client
Server calling of .exe file in the client I have a requirement with java webapplication.
We are using jboss as appserver on Linux machine.
How can I call a .exe file from client machine?
I want to run .exe from webpage like
calling java beans - JSP-Servlet calling java beans Sir,
I want to know where to place the java beans java file and class file inside tomcat web server. and how to call them from jsp file. Hi Friend,
Java Bean is placed in classes\form
Calling a jsp page from Servlet Calling a jsp page from Servlet How can I do this?
Suppose I have jsp page aaa.jsp. From aaa.jsp on form action I have made a call to a servlet xxx.java. In xxx.java I have written code to retrieve data from database through
Calling Action on form load - Struts Calling Action on form load Hi all, is it possible to call... this list is coming from the action which i m calling before the page is being... to direct user directly to this page i m calling an action which is preparing a list
PHP Returning Values from Function
Returnig Values from function:
From a function we can return values using... of the return statement the control
moves back to the calling portion.... A function can not have more than one
return statement because whenever a return
calling one jsp from another jsp page calling one jsp from another jsp page need coding for calling one jsp from another jsp including the xml file.Its urgent
calling from iphone through programitically in iphone calling from iphone through programitically in iphone calling from iphone through programitically in iphone
please help me
my senario is if i click send sms button message should deliver to xyz person and that xyz person make
How I call the function union from the main - Java Interview Questions
},
};
//calling the function union : paramtere to pass is mat
//how i call...How I call the function union from the main Please, from
public static void main(String[] args)
I would like to call the function union and I
calling webservices that return complexTypes in android using ksoap2 calling webservices that return complexTypes in android using ksoap2 Can anyone direct me to a site or show me an example ,on how to call a webservice which returns a complexType as the result, in an android app
Calling external process in Java - Java Beginners Calling external process in Java Hi,
How I can call some system command from Java? I want to run the Microsoft Calculator application from Java, how it can be done. Provide me example.
What is the use of Runtime.getRuntime
Calling java class method from javascript Calling java class method from javascript I want to call a java class method from javascript. The java class method is like "public String[] getWord()". I want to assign this string array value to a variable in javascript. I
calling servlet from jsp in netbeans ide calling servlet from jsp in netbeans ide I have tried to call servlet from jsp code in netbeans for checking the database values . but while running it showing the error that the resource not available. i dono wat mistake i did
Calling exe through Java program. - Java Beginners Calling exe through Java program. Hi,
How to call a vb exe that takes one argument , using a Java program.
Thank You,
Umesh Kilkile Hi Friend,
Try the following code:
import java.lang.*;
import