public static Reader createReader ( File file ) throws NaaccrIOException { InputStream is = null ; try { is = new FileInputStream ( file ) ; if ( file . getName ( ) . endsWith ( ".gz" ) ) is = new GZIPInputStream ( is ) ; return new InputStreamReader ( is , StandardCharsets . UTF_8 ) ; } catch ( IOException e ) { if ( is != null ) { try { is . close ( ) ; } catch ( IOException e1 ) { // give up } } throw new NaaccrIOException ( e . getMessage ( ) ) ; } }
Returns a generic reader for the provided file taking care of the optional GZ compression .