public void findPackageAndClass() throws IOException {
  packageName=null;
  className=null;
  LineNumberReader reader=new LineNumberReader(new FileReader(inputFile));
  while (className == null || packageName == null) {
    String line=reader.readLine();
    if (line == null)     break;
    if (packageName == null) {
      int index=line.indexOf("package");
      if (index >= 0) {
        index+=7;
        int end=line.indexOf(';',index);
        if (end >= index) {
          packageName=line.substring(index,end);
          packageName=packageName.trim();
        }
      }
    }
    if (className == null) {
      int index=line.indexOf("%class");
      if (index >= 0) {
        index+=6;
        className=line.substring(index);
        className=className.trim();
      }
    }
  }
  if (className == null)   className="Yylex";
}

public void findPackageAndClass ( ) throws IOException { packageName = null ; className = null ; LineNumberReader reader = new LineNumberReader ( new FileReader ( inputFile ) ) ; while ( className == null || packageName == null ) { String line = reader . readLine ( ) ; if ( line == null ) break ; if ( packageName == null ) { int index = line . indexOf ( "package" ) ; if ( index >= 0 ) { index += 7 ; int end = line . indexOf ( ';' , index ) ; if ( end >= index ) { packageName = line . substring ( index , end ) ; packageName = packageName . trim ( ) ; } } } if ( className == null ) { int index = line . indexOf ( "%class" ) ; if ( index >= 0 ) { index += 6 ; className = line . substring ( index ) ; className = className . trim ( ) ; } } } if ( className == null ) className = "Yylex" ; }
peek into . flex file to get package and class name
