code: public InputStream read() throws IOException {
          if(file.exists())
              try {
                  return Files.newInputStream(file.toPath());
              } catch (InvalidPathException e) {
                  throw new IOException(e);
              }
  
          // check if the compressed file exists
          if(gz.exists())
              try {
                  return new GZIPInputStream(Files.newInputStream(gz.toPath()));
              } catch (InvalidPathException e) {
                  throw new IOException(e);
              }
  
          // no such file
          throw new FileNotFoundException(file.getName());
      }
docs: Reads the contents of a file.