} catch (IOException ex)
{
}
- ;
if (dta != null && dta.indexOf("*") > -1)
{
starterm = true;
// read as a FASTA (probably)
break;
}
- if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML,
+ int lessThan = data.indexOf("<");
+ if ((lessThan > -1)) // possible Markup Language data i.e HTML,
// RNAML, XML
{
- // FIXME this is nuts - it consumes the rest of the file if no match
- boolean identified = false;
- do
- {
- if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
- {
- reply = HtmlFile.FILE_DESC;
- identified = true;
- break;
- }
-
- if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
- {
- reply = "RNAML";
- identified = true;
- break;
- }
- } while ((data = source.nextLine()) != null);
-
- if (identified)
+ String upper = data.toUpperCase();
+ if (upper.substring(lessThan).startsWith("<HTML"))
{
+ reply = HtmlFile.FILE_DESC;
break;
}
- if (data == null)
+ if (upper.substring(lessThan).startsWith("<RNAML"))
{
+ reply = "RNAML";
break;
}
}