private boolean export(String path, String saveName)
{
ServletOutputStream sos = null;
FileInputStream in = null;
try
{
String filename = URLDecoder.decode(path, "utf-8");
if (null == filename || "".equals(filename))
{
return false;
}
else
{
sos = getResponse().getOutputStream();
getResponse().reset();
getResponse().setContentType("txt/html");
getResponse().setHeader("Content-disposition",
"attachment;filename=" + saveName);
byte b[] = new byte[Constants.KB];
in = new FileInputStream(filename);
int n = 0;
while ((n = in.read(b)) != -1)
{
sos.write(b, 0, n);
}
sos.flush();
}
}
catch (FileNotFoundException e)
{
logger.debug("Download File failure.", e);
return false;
}
catch (Exception e)
{
logger.debug("Download File failure.", e);
return false;
}
finally
{
close(in);
close(sos);
}
return true;
}
{
ServletOutputStream sos = null;
FileInputStream in = null;
try
{
String filename = URLDecoder.decode(path, "utf-8");
if (null == filename || "".equals(filename))
{
return false;
}
else
{
sos = getResponse().getOutputStream();
getResponse().reset();
getResponse().setContentType("txt/html");
getResponse().setHeader("Content-disposition",
"attachment;filename=" + saveName);
byte b[] = new byte[Constants.KB];
in = new FileInputStream(filename);
int n = 0;
while ((n = in.read(b)) != -1)
{
sos.write(b, 0, n);
}
sos.flush();
}
}
catch (FileNotFoundException e)
{
logger.debug("Download File failure.", e);
return false;
}
catch (Exception e)
{
logger.debug("Download File failure.", e);
return false;
}
finally
{
close(in);
close(sos);
}
return true;
}