File: Util.java

package info (click to toggle)
chromimpute 1.0.3%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: java: 6,018; makefile: 9; sh: 1
file content (28 lines) | stat: -rw-r--r-- 634 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package ernst.ChromImpute;

import java.io.*;
import java.util.*;
import java.util.zip.*;

public class Util
{
    /**
     * Returns a buffered reader. If szFile ends in a ".gz" tries to open it as a gzip file
     * otherwise tries to open it as a normal file.
     */
    public static BufferedReader getBufferedReader(String szFile) throws IOException
    {
        BufferedReader br;
	if (szFile.endsWith(".gz"))
	{
		br =new BufferedReader(new InputStreamReader(
							     new GZIPInputStream(new FileInputStream(szFile))));
        }
	else
	{
		br = new BufferedReader(new FileReader(szFile));
        }
	return br;
    }

}