<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 組件源碼 ``` /** * <b>方法描述:</b> Base64編碼 <br/> * <b>創建者:</b> admin <br/> * <b>創建時間:</b> 2020-12-17 10:49:25 <br/> * * @param contants * 入參|待編碼數據(byte數組或字符串,文件名)|{@link Object} * @param isfile * 入參|是否文件|boolean * @param codeset * 入參|字符串編碼(UTF-8或GBK)|{@link java.lang.String} * @param base64txt * 出參|編碼后的內容|{@link java.lang.String} * @return -1 異常<br/> * 0 失敗<br/> * 1 成功<br/> */ @Component(label = "Base64編碼", style = "判斷型", type = "同步組件", comment = "對輸入內容進行編碼,如果是文件,輸入文件名,根據文件名讀取文件內容后對其編碼。如果是字符串,需要指定字符串的編碼(默認utf-8).", version = "1.0.0", deprecated = false, author = "admin", date = "2020-12-17 10:49:25") @InParams(param = {@Param(name = "contants", comment = "待編碼數據(byte數組或字符串,文件名)", type = Object.class), @Param(name = "isfile", comment = "是否文件", type = boolean.class), @Param(name = "codeset", comment = "字符串編碼(UTF-8或GBK)", type = java.lang.String.class)}) @OutParams(param = {@Param(name = "base64txt", comment = "編碼后的內容", type = java.lang.String.class)}) @Returns( returns = {@Return(id = "-1", desp = "異常"), @Return(id = "0", desp = "失敗"), @Return(id = "1", desp = "成功")}) @Order(value = 2) public static ResultBase P_base64Enc(Object contants, boolean isfile, String codeset) { String strErr = ""; if (contants == null) { return ResultBase.newFailureResult("TPTC0001", "base64Enc-待編碼內容不能為空"); } try { if (isfile) { String fileName = contants.toString(); File file = new File(fileName); FileInputStream fis = new FileInputStream(file); byte[] buffer = new byte[(int)file.length()]; fis.read(buffer); fis.close(); ResultBase.newSuccessResult(new BASE64Encoder().encode(buffer)); } else { if(StrUtil.isBlank(codeset)) codeset="utf-8"; if (contants instanceof String) { return ResultBase .newSuccessResult(new BASE64Encoder().encode(((String)contants).getBytes(codeset))); } else if (contants instanceof byte[]) { return ResultBase.newSuccessResult(new BASE64Encoder().encode((byte[])contants)); } strErr = "不支持的數據類型"; } } catch (Exception ex) { strErr = AppLog.errorMsg(ex); } return ResultBase.newExceptionResult("TPTC0002", "base64Enc-編碼錯誤:" + strErr); } ``` # 交易中組件使用方式 ![](https://img.kancloud.cn/74/88/7488ab7165d17f001313b83eb93e96ce_1868x867.png) # 參數說明及示例 ## 入口參數 待編碼數據(byte數組或字符串,文件名):準備進行 Base64 編碼的數據,示例: `"abc"` 是否文件:數據是否是文件,示例: `false` 字符串編碼(UTF-8或GBK):設置字符串的編碼格式,示例: `"utf-8"` ## 出口參數 編碼后的內容:經過 Base64 編碼后的數據,示例: `__INNER__["result"]`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看