public boolean zipFile(String filePath,String changeNumber){
boolean flag;
try{
String xmlPath = filePath + changeNumber+".xml";
File file = new File(xmlPath);
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(filePath+changeNumber+".AXML"));
// ZipEntry entry = new ZipEntry(filePath + changeNumber+".xml");
ZipEntry entry = new ZipEntry(changeNumber+".xml");
zipOut.putNextEntry(entry);
InputStream is = null;
try {
is = new FileInputStream(file);
int BUFFERSIZE = 2 << 10;
int length = 0;
byte[] buffer = new byte[BUFFERSIZE];
while ((length = is.read(buffer, 0, BUFFERSIZE)) >= 0) {
zipOut.write(buffer, 0, length);
}
zipOut.flush();
zipOut.closeEntry();
} catch (Exception ex) {
throw ex;
} finally {
if (null != is) {
is.close();
}
}
DataOutputStream dataOs = new DataOutputStream(zipOut);
dataOs.close();
flag = true;
}catch(Exception e){
flag = false;
}
return flag;
}
boolean flag;
try{
String xmlPath = filePath + changeNumber+".xml";
File file = new File(xmlPath);
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(filePath+changeNumber+".AXML"));
// ZipEntry entry = new ZipEntry(filePath + changeNumber+".xml");
ZipEntry entry = new ZipEntry(changeNumber+".xml");
zipOut.putNextEntry(entry);
InputStream is = null;
try {
is = new FileInputStream(file);
int BUFFERSIZE = 2 << 10;
int length = 0;
byte[] buffer = new byte[BUFFERSIZE];
while ((length = is.read(buffer, 0, BUFFERSIZE)) >= 0) {
zipOut.write(buffer, 0, length);
}
zipOut.flush();
zipOut.closeEntry();
} catch (Exception ex) {
throw ex;
} finally {
if (null != is) {
is.close();
}
}
DataOutputStream dataOs = new DataOutputStream(zipOut);
dataOs.close();
flag = true;
}catch(Exception e){
flag = false;
}
return flag;
}