git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
06c84c2
)
JAL-3744 this obvious attempt to detect/gunzip file input for jalviewjs fails
bug/JAL-3744_read_gzip_file_in_jalviewjs
author
Ben Soares
<b.soares@dundee.ac.uk>
Thu, 10 Sep 2020 14:27:08 +0000
(15:27 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Thu, 10 Sep 2020 14:27:08 +0000
(15:27 +0100)
src/jalview/io/FileParse.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/FileParse.java
b/src/jalview/io/FileParse.java
index
2ff0d27
..
8a48012
100755
(executable)
--- a/
src/jalview/io/FileParse.java
+++ b/
src/jalview/io/FileParse.java
@@
-230,7
+230,7
@@
public class FileParse
return false;
}
input.mark(4);
return false;
}
input.mark(4);
-
+
// get first 2 bytes or return false
byte[] bytes = new byte[2];
int read = input.read(bytes);
// get first 2 bytes or return false
byte[] bytes = new byte[2];
int read = input.read(bytes);
@@
-239,7
+239,7
@@
public class FileParse
{
return false;
}
{
return false;
}
-
+
int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
return (GZIPInputStream.GZIP_MAGIC == header);
}
int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
return (GZIPInputStream.GZIP_MAGIC == header);
}
@@
-286,7
+286,9
@@
public class FileParse
BufferedReader inData = new BufferedReader(
new InputStreamReader(new GZIPInputStream(inputStream)));
inData.mark(2048);
BufferedReader inData = new BufferedReader(
new InputStreamReader(new GZIPInputStream(inputStream)));
inData.mark(2048);
+ System.out.println("ABOUT TO inData.read()");
inData.read();
inData.read();
+ System.out.println("ABOUT TO inData.reset()");
inData.reset();
return inData;
}
inData.reset();
return inData;
}
@@
-448,8
+450,15
@@
public class FileParse
{
// this will be from JavaScript
inFile = file;
{
// this will be from JavaScript
inFile = file;
- dataIn = new BufferedReader(
- new InputStreamReader(new ByteArrayInputStream(bytes)));
+ // dataIn = new BufferedReader(new InputStreamReader(new
+ // ByteArrayInputStream(bytes)));
+ try
+ {
+ dataIn = checkForGzipStream(new ByteArrayInputStream(bytes));
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
dataName = fileStr;
}
else if (checkFileSource(fileStr))
dataName = fileStr;
}
else if (checkFileSource(fileStr))