}
if (!error)
{
+ if (fileStr.toLowerCase().endsWith(".gz"))
+ {
+ try
+ {
+ dataIn = tryAsGzipSource(new FileInputStream(fileStr));
+ dataName = fileStr;
+ return error;
+ } catch (Exception x)
+ {
+ warningMessage = "Failed to resolve as a GZ stream ("
+ + x.getMessage() + ")";
+ x.printStackTrace();
+ }
+ ;
+ }
+
dataIn = new BufferedReader(new FileReader(fileStr));
dataName = fileStr;
}
return error;
}
-
+ private BufferedReader tryAsGzipSource(InputStream inputStream) throws Exception
+ {
+ BufferedReader inData = new BufferedReader(new InputStreamReader(new GZIPInputStream(inputStream)));
+ inData.mark(2048);
+ inData.read();
+ inData.reset();
+ return inData;
+ }
private boolean checkURLSource(String fileStr) throws IOException,
MalformedURLException
{
//
// GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via Kenny Sabir
Exception e=null;
- if (fileStr.endsWith(".gz")) {
+ if (fileStr.toLowerCase().endsWith(".gz")) {
try {
InputStream inputStream = url.openStream();
- dataIn = new BufferedReader(new InputStreamReader(new GZIPInputStream(inputStream)));
- dataIn.mark(2048);
- dataIn.read();
- dataIn.reset();
-
+ dataIn = tryAsGzipSource(inputStream);
dataName = fileStr;
return false;
} catch (Exception ex) {