case Integer:
return new PdfInteger((Integer)token);
case Name:
return new PdfName((String)token,true);
case Literal:
return new PdfString(
Encoding.encode((String)token),
PdfString.SerializationModeEnum.Literal
);
case DictionaryBegin:
{
PdfDictionary dictionary = new PdfDictionary();
// Populate the dictionary.
while(true)
{
// Key.
moveNext();
if(tokenType == TokenTypeEnum.DictionaryEnd)
break;
PdfName key = (PdfName)parsePdfObject();
// Value.
moveNext();
PdfDirectObject value = parsePdfObject();
// Add the current entry to the dictionary!
dictionary.put(key,value);
}
return dictionary;
}
case ArrayBegin:
{
PdfArray array = new PdfArray();
// Populate the array.
while(true)
{
// Value.
moveNext();
if(tokenType == TokenTypeEnum.ArrayEnd)
break;
// Add the current item to the array!
array.add(parsePdfObject());
}
return array;
}
case Real:
return new PdfReal((Float)token);
case Boolean:
return PdfBoolean.get((Boolean)token);
case Date:
return new PdfDate((Date)token);
case Hex:
try
{
return new PdfString(
(String)token,
PdfString.SerializationModeEnum.Hex
);
}
catch(Exception e)