String message = "Did not find block " + id;
LOG.error(message);
throw new IOException(message);
}
Payload payload = cloudBlob.getPayload();
try {
byte[] data = ByteStreams.toByteArray(payload.getInput());
if (blockId.getPos() == 0) {
return data;
}
int len = (int) (data.length - blockId.getPos());
if (len < 0) {
return new byte[0];
}
byte[] d2 = new byte[len];
System.arraycopy(data, (int) blockId.getPos(), d2, 0, len);
return d2;
} finally {
payload.close();
}
}