code: public static List<String> readTextFileFromStream(InputStream _input, Charset _charset, boolean _silent) {
          if (_input == null) {
              return null;
          }
          try {
              List<String> fileContent;
              try (BufferedReader dis = new BufferedReader(new InputStreamReader(_input, _charset))) {
                  String s;
                  fileContent = new ArrayList<>();
                  while ((s = dis.readLine()) != null) {
                      fileContent.add(s);
                  }
              }
  
              return fileContent.size() > 0 ? fileContent : null;
          } catch (IOException _ex) {
              if (!_silent) {
                  LOGGER.warn("Error while reading file:", _ex);
              }
          }
  
          return null;
      }
docs: Reads a text file from given {@link InputStream} using the given {@link Charset}.
  @param _input stream to read
  @param _charset charset to use
  @param _silent true to disable exception logging, false otherwise
  @return List of string or null on error