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;
}

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 ; }
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 .
