📄 filedownloadprovider.java
字号:
package com.cownew.phoneshow.framework.common;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import nextapp.echo2.app.filetransfer.DownloadProvider;
public class FileDownloadProvider implements DownloadProvider
{
private File file;
public FileDownloadProvider(File file)
{
super();
this.file = file;
}
public String getContentType()
{
return "application/unkown";
}
public String getFileName()
{
return file.getName();
}
public int getSize()
{
return -1;
}
public void writeFile(OutputStream os) throws IOException
{
FileInputStream fis = new FileInputStream(file);
try
{
IOUtils.copy(fis, os);
} finally
{
IOUtils.closeQuietly(fis);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -