public PdfDictionary readDictionary ( ) throws IOException { PdfDictionary dic = new PdfDictionary ( ) ; while ( true ) { if ( ! nextValidToken ( ) ) throw new IOException ( "Unexpected end of file." ) ; if ( tokeniser . getTokenType ( ) == PRTokeniser . TK_END_DIC ) break ; if ( tokeniser . getTokenType ( ) != PRTokeniser . TK_NAME ) throw new IOException ( "Dictionary key is not a name." ) ; PdfName name = new PdfName ( tokeniser . getStringValue ( ) , false ) ; PdfObject obj = readPRObject ( ) ; int type = obj . type ( ) ; if ( - type == PRTokeniser . TK_END_DIC ) throw new IOException ( "Unexpected '>>'" ) ; if ( - type == PRTokeniser . TK_END_ARRAY ) throw new IOException ( "Unexpected ']'" ) ; dic . put ( name , obj ) ; } return dic ; }
Reads a dictionary . The tokeniser must be positioned past the &lt ; &lt ; token .