import jalview.schemes.UserColourScheme;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
public boolean readAnnotationFile(AlignmentI al, ColumnSelection colSel,
String file, String protocol)
{
+ baseUri = "";
BufferedReader in = null;
try
{
if (protocol.equals(AppletFormatAdapter.FILE))
{
in = new BufferedReader(new FileReader(file));
+ baseUri = new File(file).getParent();
+ if (baseUri == null)
+ {
+ baseUri = "";
+ }
+ else
+ {
+ baseUri += "/";
+ }
}
else if (protocol.equals(AppletFormatAdapter.URL))
{
URL url = new URL(file);
in = new BufferedReader(new InputStreamReader(url.openStream()));
+ baseUri = url.toURI().getPath();
+ if (baseUri.lastIndexOf("/") > -1)
+ {
+ baseUri = baseUri.substring(0, baseUri.lastIndexOf("/")) + "/";
+ }
}
else if (protocol.equals(AppletFormatAdapter.PASTE))
{
in = new BufferedReader(new StringReader(file));
+ // TODO - support mimencoded PDBs for a paste.. ?
+ baseUri = "";
}
else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
{
if (is != null)
{
in = new BufferedReader(new java.io.InputStreamReader(is));
+ // TODO: this probably doesn't work for classloader - needs a test
+ baseUri = new File("/" + file).getParent() + "/";
}
}
if (in != null)
String lastread = "";
+ /**
+ * used for resolving absolute references to resources relative to
+ * annotationFile location
+ */
+ String baseUri = "";
+
private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
STRUCTMODEL = "STRUCTMODEL";