List of usage examples for org.springframework.jdbc.core.support AbstractLobStreamingResultSetExtractor AbstractLobStreamingResultSetExtractor
AbstractLobStreamingResultSetExtractor
From source file:com.ttech.cordovabuild.domain.asset.AssetServiceImpl.java
@Override public void handleInputStream(AssetRef assetRef, final InputStreamHandler handler) { try {//ww w . jav a 2 s . c o m jdbcTemplate.query("select data from ASSETS where UUID=?", new AbstractLobStreamingResultSetExtractor() { @Override protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException { handler.handleInputStream(lobHandler.getBlobAsBinaryStream(rs, 1)); } }, assetRef.getUuid()); } catch (LobRetrievalFailureException e) { throw new AssetRetrievalFailureException(e); } }
From source file:org.sakaiproject.imagegallery.integration.standalone.FileLibraryStandalone.java
@Transactional(readOnly = true) public void streamImage(final String fileId, final OutputStream contentStream) throws DataAccessException { jdbcTemplate.getJdbcOperations().query( "select CONTENT from IMAGE_GALLERY_STANDALONE_FILES_T where FILE_ID=?", new String[] { fileId }, new AbstractLobStreamingResultSetExtractor() { @Override//from w ww . j a v a2 s . co m protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException { InputStream inputStream = lobHandler.getBlobAsBinaryStream(rs, 1); if (inputStream != null) { FileCopyUtils.copy(inputStream, contentStream); } } }); }