是不行的,SmartUpload包下的File类是从Object继承下来的
其实SmartUpload的工作原理是这样的
首先把客户端的 file类型的表单的byte流以byte[]的形式保存在SmartUpload的实例当中
SmartUpload下的File的saveAs(String filename)方法就是生成一个FileOutputStream类
源代码如下:
public void saveAs(String destFilePathName, int optionSaveAs)
throws SmartUploadException, IOException
{
String path = new String();
path = m_parent.getPhysicalPath(destFilePathName, optionSaveAs);
if(path == null)
throw new IllegalArgumentException("There is no specified destination file (1140).");
try
{
java.io.File file = new java.io.File(path);//这就是要保存的文件路径
FileOutputStream fileOut = new FileOutputStream(file);//生成输出流
fileOut.write(m_parent.m_binArray, m_startData, m_size);//把byte[]流写入到文件当中
fileOut.close();
}
catch(IOException e)
{
throw new SmartUploadException("File can't be saved (1120).");
}
}
希望对你有帮助!祝你好运!
其实SmartUpload的工作原理是这样的
首先把客户端的 file类型的表单的byte流以byte[]的形式保存在SmartUpload的实例当中
SmartUpload下的File的saveAs(String filename)方法就是生成一个FileOutputStream类
源代码如下:
public void saveAs(String destFilePathName, int optionSaveAs)
throws SmartUploadException, IOException
{
String path = new String();
path = m_parent.getPhysicalPath(destFilePathName, optionSaveAs);
if(path == null)
throw new IllegalArgumentException("There is no specified destination file (1140).");
try
{
java.io.File file = new java.io.File(path);//这就是要保存的文件路径
FileOutputStream fileOut = new FileOutputStream(file);//生成输出流
fileOut.write(m_parent.m_binArray, m_startData, m_size);//把byte[]流写入到文件当中
fileOut.close();
}
catch(IOException e)
{
throw new SmartUploadException("File can't be saved (1120).");
}
}
希望对你有帮助!祝你好运!
解决方案 »
- 正则表达式
- 类加载和初始化顺序,多谢帮忙看看
- SWT框架的应用程序在Windows 2000下无法运行~~
- 寻找学生学籍管理系统的源代码,要求是让做成WEB的APPLET~
- 数据库的小问题!!请教
- /**小妹lily**/ JavaTM 2 Runtime Environment (J2RE)和JavaTM 2 Software Development Kit (J2SDK)有什么区别?
- 讨论!关于在HTML界面里面JAPPLET的调用的问题
- classloader 问题,谢谢
- 为什么“byte a=0x8a”出错,而“byte a=(byte)138”就可以呢??
- 怎样修改在ie中的applet的权限???
- 求救:在线等待:关于读文件,谢谢
- 为什么会出现这样的问题?
SmartUpload中的File对象和io中File对象并不一样