@@ -1488,7 +1488,7 @@ public static LinkedList<String[]> readCSVStrictly(String filename, int numColum
1488
1488
}
1489
1489
1490
1490
/**
1491
- * Get a input file stream (automatically gunzip/bunzip2 depending on file extension)
1491
+ * Get a input file stream (automatically gunzip depending on file extension)
1492
1492
* @param filename Name of file to open
1493
1493
* @return Input stream that can be used to read from the file
1494
1494
* @throws IOException if there are exceptions opening the file
@@ -1497,15 +1497,12 @@ public static InputStream getFileInputStream(String filename) throws IOException
1497
1497
InputStream in = new FileInputStream (filename );
1498
1498
if (filename .endsWith (".gz" )) {
1499
1499
in = new GZIPInputStream (in );
1500
- } else if (filename .endsWith (".bz2" )) {
1501
- //in = new CBZip2InputStream(in);
1502
- in = getBZip2PipedInputStream (filename );
1503
1500
}
1504
1501
return in ;
1505
1502
}
1506
1503
1507
1504
/**
1508
- * Get a output file stream (automatically gzip/bzip2 depending on file extension)
1505
+ * Get a output file stream (automatically gzip depending on file extension)
1509
1506
* @param filename Name of file to open
1510
1507
* @return Output stream that can be used to write to the file
1511
1508
* @throws IOException if there are exceptions opening the file
@@ -1514,9 +1511,6 @@ public static OutputStream getFileOutputStream(String filename) throws IOExcepti
1514
1511
OutputStream out = new FileOutputStream (filename );
1515
1512
if (filename .endsWith (".gz" )) {
1516
1513
out = new GZIPOutputStream (out );
1517
- } else if (filename .endsWith (".bz2" )) {
1518
- //out = new CBZip2OutputStream(out);
1519
- out = getBZip2PipedOutputStream (filename );
1520
1514
}
1521
1515
return out ;
1522
1516
}
@@ -1525,9 +1519,6 @@ public static OutputStream getFileOutputStream(String filename, boolean append)
1525
1519
OutputStream out = new FileOutputStream (filename , append );
1526
1520
if (filename .endsWith (".gz" )) {
1527
1521
out = new GZIPOutputStream (out );
1528
- } else if (filename .endsWith (".bz2" )) {
1529
- //out = new CBZip2OutputStream(out);
1530
- out = getBZip2PipedOutputStream (filename );
1531
1522
}
1532
1523
return out ;
1533
1524
}
@@ -1584,22 +1575,6 @@ public static PrintWriter getPrintWriter(String filename, String encoding) throw
1584
1575
return new PrintWriter (new BufferedWriter (new OutputStreamWriter (out , encoding )), true );
1585
1576
}
1586
1577
1587
- public static InputStream getBZip2PipedInputStream (String filename ) throws IOException {
1588
- String bzcat = System .getProperty ("bzcat" , "bzcat" );
1589
- Runtime rt = Runtime .getRuntime ();
1590
- String cmd = bzcat + " " + filename ;
1591
- //log.info("getBZip2PipedInputStream: Running command: "+cmd);
1592
- Process p = rt .exec (cmd );
1593
- Writer errWriter = new BufferedWriter (new OutputStreamWriter (System .err ));
1594
- StreamGobbler errGobbler = new StreamGobbler (p .getErrorStream (), errWriter );
1595
- errGobbler .start ();
1596
- return p .getInputStream ();
1597
- }
1598
-
1599
- public static OutputStream getBZip2PipedOutputStream (String filename ) throws IOException {
1600
- return new BZip2PipedOutputStream (filename );
1601
- }
1602
-
1603
1578
private static final Pattern tab = Pattern .compile ("\t " );
1604
1579
1605
1580
/**
0 commit comments