private static BufferedReader open(final String path) throws IOException {
    if (path.equals("-")) {
      return new BufferedReader(new InputStreamReader(System.in));
    }

    InputStream is = new FileInputStream(path);
    if (path.endsWith(".gz")) {
      is = new GZIPInputStream(is);
    }
    // I <3 Java's IO library.
    return new BufferedReader(new InputStreamReader(is));
  }
private static BufferedReader open ( final String path ) throws IOException { if ( path . equals ( "-" ) ) { return new BufferedReader ( new InputStreamReader ( System . in ) ) ; } InputStream is = new FileInputStream ( path ) ; if ( path . endsWith ( ".gz" ) ) { is = new GZIPInputStream ( is ) ; } return new BufferedReader ( new InputStreamReader ( is ) ) ; }
Opens a file for reading, handling gzipped files.
@param path The file to open.
@return A buffered reader to read the file, decompressing it if needed.
@throws IOException when shit happens.