UploadFile uploadfile = new UploadFile();
ByteArrayInputStream bytearrayinputstream = uploadfile.readFile(httpservletrequest, "filecontent");
String s11 = uploadfile.getFileName();
String s12 = uploadfile.getContentType();
ResultSet resultset = statement.executeQuery("select filename,filecontenttype,filecontent from pa_org_post where id='" + s1 + "' for update");
BLOB blob = null;
if(resultset.next())
{
blob = ((OracleResultSet)resultset).getBLOB(3);
OutputStream outputstream = blob.getBinaryOutputStream();
int i = blob.getChunkSize();
byte abyte0[] = new byte[i];
for(int j = -1; (j = bytearrayinputstream.read(abyte0)) != -1;){
outputstream.write(abyte0, 0, j);
}
bytearrayinputstream.close();
outputstream.close();
}
为什么总是出异常呢?
for(int j = -1; (j = bytearrayinputstream.read(abyte0)) != -1;)
在这段代码中抛异常请那位高手指点指点!
ByteArrayInputStream bytearrayinputstream = uploadfile.readFile(httpservletrequest, "filecontent");
String s11 = uploadfile.getFileName();
String s12 = uploadfile.getContentType();
ResultSet resultset = statement.executeQuery("select filename,filecontenttype,filecontent from pa_org_post where id='" + s1 + "' for update");
BLOB blob = null;
if(resultset.next())
{
blob = ((OracleResultSet)resultset).getBLOB(3);
OutputStream outputstream = blob.getBinaryOutputStream();
int i = blob.getChunkSize();
byte abyte0[] = new byte[i];
for(int j = -1; (j = bytearrayinputstream.read(abyte0)) != -1;){
outputstream.write(abyte0, 0, j);
}
bytearrayinputstream.close();
outputstream.close();
}
为什么总是出异常呢?
for(int j = -1; (j = bytearrayinputstream.read(abyte0)) != -1;)
在这段代码中抛异常请那位高手指点指点!
你捕获一下,看提示什么