protected boolean readHeader ( ) throws IOException , ArticleReaderException { this . taskHeader = new ArticleInformation ( ) ; int size , r = read ( ) ; StringBuilder buffer = null ; while ( r != - 1 ) { if ( buffer != null ) { buffer . append ( ( char ) r ) ; } if ( this . keywords . check ( ( char ) r ) ) { switch ( this . keywords . getValue ( ) ) { case KEY_START_TITLE : case KEY_START_ID : buffer = new StringBuilder ( ) ; break ; case KEY_END_TITLE : size = buffer . length ( ) ; buffer . delete ( size - WikipediaXMLKeys . KEY_END_TITLE . getKeyword ( ) . length ( ) , size ) ; this . taskHeader . setArticleName ( buffer . toString ( ) ) ; if ( this . articleFilter != null ) { if ( ! this . articleFilter . checkArticle ( this . taskHeader . getArticleName ( ) ) ) { return false ; } } buffer = null ; break ; case KEY_END_ID : size = buffer . length ( ) ; buffer . delete ( size - WikipediaXMLKeys . KEY_END_ID . getKeyword ( ) . length ( ) , size ) ; this . taskHeader . setArticleId ( Integer . parseInt ( buffer . toString ( ) ) ) ; buffer = null ; break ; case KEY_START_REVISION : this . keywords . reset ( ) ; return true ; default : throw ErrorFactory . createArticleReaderException ( ErrorKeys . DELTA_CONSUMERS_TASK_READER_WIKIPEDIAXMLREADER_UNEXPECTED_KEYWORD ) ; } this . keywords . reset ( ) ; } r = read ( ) ; } throw ErrorFactory . createArticleReaderException ( ErrorKeys . DELTA_CONSUMERS_TASK_READER_WIKIPEDIAXMLREADER_UNEXPECTED_END_OF_FILE ) ; }
Reads the header of an article .