File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
biojava-core/src/main/java/demo Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ package demo ;
2+
3+ import java .io .FileInputStream ;
4+ import java .io .InputStream ;
5+
6+ import org .biojava .nbio .core .util .UncompressInputStream ;
7+ import org .slf4j .Logger ;
8+ import org .slf4j .LoggerFactory ;
9+
10+ /**
11+ * Uncompresses a single tarred or zipped file, writing output to stdandard out
12+ */
13+ public class UncompressFile {
14+ private final static Logger logger
15+ = LoggerFactory .getLogger (UncompressFile .class );
16+
17+ /**
18+ * Reads a file, uncompresses it, and sends the result to stdout.
19+ * Also writes trivial statistics to stderr.
20+ * @param args An array with one String element, the name of the file to read.
21+ * @throws IOException for any failure
22+ */
23+ public static void main (String [] args ) throws Exception {
24+
25+ if (args .length != 1 ) {
26+ logger .info ("Usage: UncompressInputStream <file>" );
27+ System .exit (1 );
28+ }
29+ long beg = System .currentTimeMillis ();
30+
31+ long tot ;
32+ try (InputStream in = new FileInputStream (args [0 ]);
33+ ) {
34+ tot = UncompressInputStream .uncompress (in , System .out );
35+ }
36+
37+ long end = System .currentTimeMillis ();
38+ logger .info ("Decompressed {} bytes" , tot );
39+ logger .info ("Time: {} seconds" , (end - beg ) / 1000 );
40+ }
41+
42+ }
You can’t perform that action at this time.
0 commit comments