code: public static String inputStream2String(final InputStream is, final String charsetName) {
          if (is == null || isSpace(charsetName)) return null;
          try {
              return new String(inputStream2Bytes(is), charsetName);
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
              return null;
          }
      }
docs: inputStream转string按编码
  
  @param is          输入流
  @param charsetName 编码格式
  @return 字符串