InputStream in = blob.getBinaryStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
final int size = 1024 * 8;
byte[] buf = new byte[size];
int length = 0;
try {
while ((length = in.read(buf)) > 0) {
baos.write(buf, 0, length);
if (length < size) {
break;
}
}
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
final int size = 1024 * 8;
byte[] buf = new byte[size];
int length = 0;
try {
while ((length = in.read(buf)) > 0) {
baos.write(buf, 0, length);
if (length < size) {
break;
}
}
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}