AtomPubParser parser = new AtomPubParser(stream);
try {
parser.parse();
} catch (Exception e) {
throw new CmisConnectionException("Parsing exception!", e);
}
AtomBase parseResult = parser.getResults();
if (!clazz.isInstance(parseResult)) {
throw new CmisConnectionException("Unexpected document! Received "
+ (parseResult == null ? "something unknown" : parseResult.getType()) + "!");
}
return (T) parseResult;
}