📄 switchfilemanager.java
字号:
package com.sure.oa.oaswitch;
/**
* <p>Title: RoadOA</p>
* <p>Description: 项目</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Chinatec</p>
* @author mengzy
* @version 1.0
*/
import java.sql.*;
import java.io.*;
import java.util.Vector;
import com.sure.util.LobUtils;
import com.sure.dataabstraction.*;
import com.sure.businessmodel.Page;
public class switchfileManager {
public switchfileManager() {}
public static void saveswitchfile(switchfile bean) throws SQLException, DBPoolException {
Connection conn = DBManager.getConnection();
try{
saveswitchfile(conn, bean);
}
finally{
conn.close();
}
}
public static void saveswitchfile(Connection conn, switchfile bean) throws SQLException {
switchfilePersistent p = new switchfilePersistent(bean, (bean.getFileId().intValue() > 0) );
p.persist(conn);
}
public static Vector getList(int docId) throws DBPoolException, SQLException {
String where = "Where docId=" + docId + " order by fileId";
Connection conn = DBManager.getConnection();
try{
return switchfilePersistent.load(conn,where);
} finally {
conn.close();
}
}
public static switchfile getSwitchfile(int fileId) throws SQLException,DBPoolException {
Connection cn = DBManager.getConnection();
try {
String where = "Where fileId = " + fileId ;
Vector beans = switchfilePersistent.load(cn, where);
switchfile bean = (switchfile)beans.firstElement();
Blob blob = LobUtils.loadBlob(cn, "content", "switchfile", where);
bean.setContent(blob);
return bean;
} finally {
cn.close();
}
}
public static void main(String args[]) throws SQLException,DBPoolException,IOException,FileNotFoundException{
switchfile sfile=switchfileManager.getSwitchfile(1);
byte[] content=sfile.getContent();
FileOutputStream MyFileWriter=new FileOutputStream("E:\\导出文件"+sfile.getTitle());
InputStream MyFileReader=new ByteArrayInputStream(content);
int c;
while ((c = MyFileReader.read()) != -1)
MyFileWriter.write(c);
MyFileWriter.close();
MyFileReader.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -