// using save and then load
try
{
+ fileName = fileName.replace('\\', '/');
System.out.println("Writing jar entry " + fileName);
JarEntry entry = new JarEntry(fileName);
jout.putNextEntry(entry);
{
if (jout != null)
{
+ jarEntryName = jarEntryName.replace('\\','/');
System.out.println("Writing jar entry " + jarEntryName);
jout.putNextEntry(new JarEntry(jarEntryName));
DataOutputStream dout = new DataOutputStream(jout);
return af;
}
- @SuppressWarnings("unused")
-private jarInputStreamProvider createjarInputStreamProvider(
- final Object ofile) throws MalformedURLException
- {
-
- // BH 2018 allow for bytes already attached to File object
- final String file = ofile.toString();
- byte[] bytes = /** @j2sNative ofile._bytes ||*/null;
- if (bytes != null) {
-
- return new jarInputStreamProvider()
- {
-
- @Override
- public JarInputStream getJarInputStream() throws IOException
- {
- return new JarInputStream(new ByteArrayInputStream(bytes));
- }
-
- @Override
- public String getFilename()
- {
- return file;
- }
- };
-
+ @SuppressWarnings("unused")
+ private jarInputStreamProvider createjarInputStreamProvider(final Object ofile) throws MalformedURLException {
+
+ // BH 2018 allow for bytes already attached to File object
+ try {
+ String file = (ofile instanceof File ? ((File) ofile).getCanonicalPath() : ofile.toString());
+ byte[] bytes = /** @j2sNative ofile._bytes || */
+ null;
+ URL url = null;
+ errorMessage = null;
+ uniqueSetSuffix = null;
+ seqRefIds = null;
+ viewportsAdded.clear();
+ frefedSequence = null;
+
+ if (file.startsWith("http://")) {
+ url = new URL(file);
+ }
+ final URL _url = url;
+ return new jarInputStreamProvider() {
+
+ @Override
+ public JarInputStream getJarInputStream() throws IOException {
+ if (bytes != null) {
+ System.out.println("Jalview2XML: opening byte jarInputStream for bytes.length=" + bytes.length);
+ return new JarInputStream(new ByteArrayInputStream(bytes));
+ }
+ if (_url != null) {
+ System.out.println("Jalview2XML: opening url jarInputStream for " + _url);
+ return new JarInputStream(_url.openStream());
+ } else {
+ System.out.println("Jalview2XML: opening file jarInputStream for " + file);
+ return new JarInputStream(new FileInputStream(file));
+ }
+ }
+
+ @Override
+ public String getFilename() {
+ return file;
+ }
+ };
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
}
- URL url = null;
- errorMessage = null;
- uniqueSetSuffix = null;
- seqRefIds = null;
- viewportsAdded.clear();
- frefedSequence = null;
-
- if (file.startsWith("http://"))
- {
- url = new URL(file);
- }
- final URL _url = url;
- return new jarInputStreamProvider()
- {
-
- @Override
- public JarInputStream getJarInputStream() throws IOException
- {
- if (_url != null)
- {
- return new JarInputStream(_url.openStream());
- }
- else
- {
- return new JarInputStream(new FileInputStream(file));
- }
- }
-
- @Override
- public String getFilename()
- {
- return file;
- }
- };
- }
/**
* Recover jalview session from a jalview project archive. Caller may
for (int i = 0; i < entryCount; i++)
{
jarentry = jin.getNextJarEntry();
+ System.out.println("Jalview2XML#loadJalviewAlign: jarentry=" + (jarentry == null ? null : jarentry.getName()));
}
if (jarentry != null && jarentry.getName().endsWith(".xml"))
JAXBElement<JalviewModel> jbe = um
.unmarshal(streamReader, JalviewModel.class);
JalviewModel object = jbe.getValue();
-
+ System.out.println("processing JalviewModel object=" + object);
/*
Unmarshaller unmar = new Unmarshaller(object);
unmar.setValidation(false);
do
{
entry = jin.getNextJarEntry();
+ System.out.println("Jalview2XML#copyJarEntry: jarentry=" + (entry == null ? null : entry.getName()));
} while (entry != null && !entry.getName().equals(jarEntryName));
if (entry != null)
{
do
{
entry = jin.getNextJarEntry();
+ System.out.println("Jalview2XML#readJarEntry: jarentry=" + (entry == null ? null : entry.getName()));
} while (entry != null && !entry.getName().equals(jarEntryName));
if (entry != null)