private static void parseLine ( String line , Listener l , boolean isEscaped ) throws IOException { // extract the record type int idx = line . indexOf ( ' ' ) ; String recType = line . substring ( 0 , idx ) ; String data = line . substring ( idx + 1 , line . length ( ) ) ; Matcher matcher = pattern . matcher ( data ) ; Map < Keys , String > parseBuffer = new HashMap < Keys , String > ( ) ; while ( matcher . find ( ) ) { String tuple = matcher . group ( 0 ) ; String [ ] parts = StringUtils . split ( tuple , StringUtils . ESCAPE_CHAR , ' ' ) ; String value = parts [ 1 ] . substring ( 1 , parts [ 1 ] . length ( ) - 1 ) ; if ( isEscaped ) { value = StringUtils . unEscapeString ( value , StringUtils . ESCAPE_CHAR , charsToEscape ) ; } parseBuffer . put ( Keys . valueOf ( parts [ 0 ] ) , value ) ; } l . handle ( RecordTypes . valueOf ( recType ) , parseBuffer ) ; parseBuffer . clear ( ) ; }
Parse a single line of history .