/**
* 加入附件
* @param String path
* @return
* @throws IOException
*/
public static byte[] insertBlob( String path) throws IOException{
byte[] buffer = new byte[1];
buffer[0] = 1;
InputStream in = null;
in = new FileInputStream(path);
byte[] b = new byte[(int) in.available()];
in.read(b);
return b;
}
/**
* 取出包含的附件
* @param Object obj, String path
* @return
* @throws SQLException
*/
public static void writeBlobByPath(Object obj, String path) throws IOException, SQLException{
// BLOB blob = (BLOB)obj;
byte[] blob = (byte[])obj;
InputStream ins = new ByteArrayInputStream(blob);
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(path));
BufferedInputStream in = new BufferedInputStream(ins);
int c;
while ((c=in.read())!=-1) {
out.write(c);
}
in.close();
out.close();
}