InputStream is = resource.read();
try {
// CBZip2InputStream expects the opening "BZ" to be skipped
byte[] skip = new byte[2];
is.read(skip);
return new CBZip2InputStream(is);
} catch (Exception e) {
String message = String.format("Unable to create bzip2 input stream for resource %s.", resource.getDisplayName());
throw new ResourceException(message, e);
}
}