private boolean createZIP(List list, String strOutputFileName) {
		byte[]			buffer	= new byte[2048];

		try {
			ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(strOutputFileName));
			String	strFileName = "";
	 
			for (int i=0; i<list.size(); i++){
				strFileName	= (String) list.get(i);
				strFileName = strFileName.substring(12);
				
				File f	= new File(uploadPath + File.separator + strFileName);
				FileInputStream fin = new FileInputStream(f);
		
				ZipEntry ze = new ZipEntry(f.getName());
				ze.setTime( f.lastModified() );
				zout.putNextEntry(ze);
				
				int nlen	= 0;
				while( (nlen = fin.read(buffer) ) > 0) {
					zout.write(buffer, 0, nlen);
				}
				zout.closeEntry();
				fin.close();
			}
			zout.close();
			return true;
		}
		catch (IOException e) 
		{
			e.printStackTrace();
		    return false;
		}
	}

+ Recent posts