import jalview.schemes.ColourSchemeI;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
+import jalview.ws.utils.UrlDownloadClient;
+import java.nio.file.Files;
import java.util.StringTokenizer;
import java.util.Vector;
// open a new source and read from it
FormatAdapter fa = new FormatAdapter();
+ boolean downloadStructureFile = format.isStructureFile()
+ && protocol.equals(DataSourceType.URL);
+ if (downloadStructureFile)
+ {
+ String structExt = format.getExtensions().split(",")[0];
+ String tempStructurefile = Files.createTempFile(".jalview_",
+ "." + structExt).toString();
+ UrlDownloadClient.download(file, tempStructurefile);
+ file = tempStructurefile;
+ protocol = DataSourceType.FILE;
+ }
al = fa.readFile(file, protocol, format);
source = fa.getAlignFile(); // keep reference for later if
// necessary.
* the name of file to save the URLs to
* @throws IOException
*/
- public void download(String urlstring, String outfile) throws IOException
+ public static void download(String urlstring, String outfile)
+ throws IOException
{
FileOutputStream fos = null;
ReadableByteChannel rbc = null;