Code example for Blob

Methods: getBinaryStream

0
			if (resultSet.next()) {
				String userId = resultSet.getString(1);
				String contentType = resultSet.getString(2);
				Blob contentBlob = resultSet.getBlob(3);
 
				InputStream contentStream = contentBlob.getBinaryStream();
				try { 
					byte[] content = IOUtils.toByteArray(contentStream);
					return new MockedUserImage(identifier, userId, contentType, content);
				} finally { 
					contentStream.close();
				} 
			} 
		} catch (SQLException | IOException e) {
			throw new UnexpectedSchoolDataBridgeException(e);
		} 
 
		return null; 
	} 
	 
	@Override