code: public static String readFirstLine(InputStream is, String encoding) throws IOException {
          try (BufferedReader reader = new BufferedReader(
                  encoding == null ? new InputStreamReader(is) : new InputStreamReader(is, encoding))) {
              return reader.readLine();
          }
      }
docs: Read the first line of the given stream, close it, and return that line.
  
  @param encoding
  If null, use the platform default encoding.
  @since 1.422