[
https://issues.apache.org/jira/browse/JENA-1554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16500415#comment-16500415
]
ASF GitHub Bot commented on JENA-1554:
--------------------------------------
Github user afs commented on a diff in the pull request:
https://github.com/apache/jena/pull/427#discussion_r192794317
--- Diff: jena-base/src/main/java/org/apache/jena/atlas/io/IO.java ---
@@ -77,10 +81,28 @@ static public InputStream openFileEx(String filename)
throws IOException, FileNo
filename = IRILib.decode(filename) ;
}
InputStream in = new FileInputStream(filename) ;
- if ( filename.endsWith(".gz") )
- in = new GZIPInputStream(in) ;
+ String ext = FileOps.extension(filename);
+ switch ( ext ) {
+ case "": return in;
+ case "gz": return new GZIPInputStream(in) ;
+ case "bz2": return new BZip2CompressorInputStream(in);
+ case "sz": return new SnappyCompressorInputStream(in);
+ }
return in ;
}
+
+ private static String[] extensions = { ".gz", ".bz2", ".sz" };
+
+ /** The filename without any compression extension, or the original
filename.
+ * It tests for compression types handled by {@link #openFileEx}.
+ */
+ static public String filenameNoCompression(String filename) {
+ for ( String ext : extensions ) {
+ if ( filename.endsWith(ext) )
+ return filename.substring(0,
filename.length()-ext.length());
+ }
+ return filename;
+ }
--- End diff --
Done.
> Support bz2 compression for parsing and loading.
> ------------------------------------------------
>
> Key: JENA-1554
> URL: https://issues.apache.org/jira/browse/JENA-1554
> Project: Apache Jena
> Issue Type: Improvement
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
> Priority: Major
> Labels: newbie
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)