// it is not documented in the ArcSDE API how you know there are no more rows to fetch!
// I'm assuming: query.fetch returns null (empiric tests indicate this assumption is correct).
boolean allRowsFetched = false;
while(! allRowsFetched) {
SeRow row = query.fetch();
if(row != null) {
ByteArrayInputStream bytes = row.getBlob(0);
byte [] buff = new byte[bytes.available()];
bytes.read(buff);
String document = new String(buff, Constants.ENCODING);