publicbooleanreadbigfield(ResultSetrs,StringvPath,StringvCoulmName){ booleanbIsNotNull=false; OutputStreamout=null; InputStreamin=null; Filefile=null; tr...
public boolean readbigfield(ResultSet rs, String vPath,String vCoulmName) {
boolean bIsNotNull=false;
OutputStream out =null;
InputStream in =null;
File file = null;
try {
//System.out.println(rs.getBinaryStream(vCoulmName));
@SuppressWarnings("unused")
Object obj=rs.getObject(vCoulmName);
in = rs.getBinaryStream(vCoulmName);
if(in==null){
bIsNotNull=false;
}
file = new File(vPath);
out = new BufferedOutputStream(
new FileOutputStream(file));
byte[] buff = new byte[1024];
for (int i = 0; (i = in.read(buff)) > 0;) {
out.write(buff, 0, i);
}
bIsNotNull=true;
} catch (Exception e) {
System.out.println(vCoulmName+"字段名称"+e.getMessage());
bIsNotNull=false;
}finally{
try {
out.flush();
in.close();
in=null;
out.close();
out=null;
file=null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return bIsNotNull;
}
展开