您希望将blob作为输入流并将其内容转储到输出流。因此,“痛苦”应类似于:
Blob blob = rs.getBlob(column);InputStream in = blob.getBinaryStream();OutputStream out = new FileOutputStream(someFile);byte[] buff = new byte[4096]; // how much of the blob to read/write at a timeint len = 0;while ((len = in.read(buff)) != -1) { out.write(buff, 0, len);}如果您发现自己做了很多这样的IO工作,则可以考虑使用Apache Commons
IO来处理细节。然后,设置流之后的所有内容都将是:
IOUtils.copy(in, out);



