*/
public class IdentifyFile
{
+ public static final String GFF3File = "GFF v2 or v3";
+
/**
* Identify a datasource's file content.
*
}
while ((data = source.nextLine()) != null)
{
- length += data.length();
+ length += data.trim().length();
if (!lineswereskipped)
{
for (int i = 0; !isBinary && i < data.length(); i++)
}
data = data.toUpperCase();
- if ((data.indexOf("# STOCKHOLM") > -1))
+ if (data.startsWith("##GFF-VERSION"))
{
- reply = "STH";
-
+ reply = GFF3File;
break;
}
- if (data.indexOf("{\"") > -1)
+ if (data.indexOf("# STOCKHOLM") > -1)
{
- reply = JSONFile.FILE_DESC;
+ reply = "STH";
break;
}
// if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
- reply = "HTML";
+ reply = HtmlFile.FILE_DESC;
break;
}
if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
reply = "RNAML";
-
break;
}
+ if (data.indexOf("{\"") > -1)
+ {
+ reply = JSONFile.FILE_DESC;
+ break;
+ }
if ((data.length() < 1) || (data.indexOf("#") == 0))
{
lineswereskipped = true;