public static Blob file2Blob(final File file, final BytesPool pool) { InputStream is = null; PooledBytesOutputStream os = null; try { is = new FileInputStream(file); os = new PooledBytesOutputStream(pool); inputStream2OutputStream(is, os); return os.drainToBlob(); } catch (Exception e) { LOG.warn( "exception when file2Blob for file {}, detail: {}", file, ExceptionUtils.exception2detail(e)); } finally { if (null != is) { try { is.close(); } catch (IOException e) { } } if (null != os) { try { os.close(); } catch (IOException e) { } } } return null; }