question: protected boolean attachInput ( InputStream is ) { boolean isOfx1 = true ; boolean result = false ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( is ) ) ; reader . mark ( HEADER_SIZE + 100 ) ; String header = "" ; for ( int i = 0 ; i < HEADER_SIZE ; i ++ ) { header = header + reader . readLine ( ) ; } if ( ( header . indexOf ( "<?OFX" ) != - 1 ) || ( header . indexOf ( "<?ofx" ) != - 1 ) ) { isOfx1 = false ; } else if ( ( header . indexOf ( "<?XML" ) != - 1 ) || ( header . indexOf ( "<?xml" ) != - 1 ) ) { isOfx1 = false ; } else { isOfx1 = true ; } reader . reset ( ) ; if ( isOfx1 ) { m_reader = new BufferedReader ( new InputStreamReader ( new OFX1ToXML ( reader ) ) ) ; } else { m_reader = reader ; } result = true ; } catch ( IOException e ) { m_errorMessage = "ErrorReadingData" ; m_errorDescription = e . getMessage ( ) ; return result ; } return result ; }
target:  Attach OFX input source, detect whether we are dealing with OFX1 (SGML) or OFX2 (XML). In case of OFX1, process the data to create  valid XML.