int nRead;
byte[] buffer = new byte[1024];
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
while (rs.next()) {
SubscriptionEntry subscriptionEntry = new SubscriptionEntry();
subscriptionEntry.setSubscriptionId(rs.getString("SubscriptionId"));
/*
* Read Binary Stream
*/
InputStream inStream = null;
try {
inStream = rs.getBinaryStream("content");
while ((nRead = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, nRead);
}
outStream.flush();
subscriptionEntry.setSubscribeXml(new String(outStream.toByteArray()));
} catch (IOException ie) {
logger.error("Unable to read XML from database", ie);
// skip this subscription entry