package com.fgkj.actions;
|
|
import java.io.FileInputStream;
|
import java.io.FileNotFoundException;
|
import java.io.IOException;
|
import java.io.InputStream;
|
import java.io.UnsupportedEncodingException;
|
|
public class FileDownloadAction extends ActionUtil{
|
private String PageName;
|
private String filename;
|
private String arr_Td;
|
private String arr_Th;
|
private String contentLength;
|
//返回一个输入流,作为一个客户端来说是一个输入流,但对于服务器端是一个 输出流
|
public InputStream getDownloadFile(){
|
InputStream is = null;
|
filename = "spket-1.6.23.jar";
|
try {
|
is = new FileInputStream("D:\\spket-1.6.23.jar");
|
//解解乱码
|
this.filename = new String(this.filename.getBytes("GBK"),"ISO-8859-1");
|
this.contentLength = is.available()+"";
|
System.out.println(contentLength);
|
} catch (FileNotFoundException e) {
|
e.printStackTrace();
|
} catch (UnsupportedEncodingException e) {
|
e.printStackTrace();
|
} catch (IOException e) {
|
e.printStackTrace();
|
}
|
System.out.println("返回输入流"+is);
|
return is;
|
}
|
|
public String getFilename() {
|
return filename;
|
}
|
|
public void setPagename(String pagename) {
|
PageName = pagename;
|
}
|
|
public void setArr_Td(String arr_Td) {
|
this.arr_Td = arr_Td;
|
}
|
|
public void setArr_Th(String arr_Th) {
|
this.arr_Th = arr_Th;
|
}
|
|
public String getContentLength() {
|
return contentLength;
|
}
|
|
public void setContentLength(String contentLength) {
|
this.contentLength = contentLength;
|
}
|
|
}
|