public PdfDictionary ReadDictionary()
{
PdfDictionary dic = new PdfDictionary();
while (true) {
if (!NextValidToken())
throw new IOException(MessageLocalization.GetComposedMessage("unexpected.end.of.file"));
if (tokeniser.TokenType == PRTokeniser.TokType.END_DIC)
break;
if (tokeniser.TokenType != PRTokeniser.TokType.NAME)
throw new IOException(MessageLocalization.GetComposedMessage("dictionary.key.is.not.a.name"));
PdfName name = new PdfName(tokeniser.StringValue, false);
PdfObject obj = ReadPRObject();
int type = obj.Type;
if (-type == (int)PRTokeniser.TokType.END_DIC)
throw new IOException(MessageLocalization.GetComposedMessage("unexpected.gt.gt"));
if (-type == (int)PRTokeniser.TokType.END_ARRAY)
throw new IOException(MessageLocalization.GetComposedMessage("unexpected.close.bracket"));
dic.Put(name, obj);
}
return dic;
}