}
private void initializeReading() throws OpenwireException {
checkWriteOnlyBody();
if (dataIn == null) {
Buffer data = getContent();
if (data == null) {
data = new Buffer(new byte[] {}, 0, 0);
}
InputStream is = new ByteArrayInputStream(data);
if (isCompressed()) {
// keep track of the real length of the content if
// we are compressed.
try {
DataInputStream dis = new DataInputStream(is);
length = dis.readInt();
dis.close();
} catch (IOException e) {
throw new OpenwireException(e);
}
is = new InflaterInputStream(is);
} else {
length = data.getLength();
}
dataIn = new DataInputStream(is);
}
}