Creates the most specific {@link PropertySet} from an {@link
InputStream}. This is preferrably a {@link
DocumentSummaryInformation} or a {@link SummaryInformation}. If
the specified {@link InputStream} does not contain a property
set stream, an exception is thrown and the {@link InputStream}
is repositioned at its beginning.
final PropertySet ps = new PropertySet(stream);
try
{
if (ps.isSummaryInformation())
return new SummaryInformation(ps);
else if (ps.isDocumentSummaryInformation())
return new DocumentSummaryInformation(ps);
else
return ps;
}
catch (UnexpectedPropertySetTypeException ex)
{
/* This exception will never be throws because we already checked
* explicitly for this case above. */
throw new UnexpectedException(ex.toString());
}