Cannot resolve method ‘decodeBase64‘ in ‘Base64‘

这篇具有很好参考价值的文章主要介绍了Cannot resolve method ‘decodeBase64‘ in ‘Base64‘。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

解决办法:

1、先查看包有没有导对

import java.util.Base64;

2、查看官网发现,JDK中的/lib/tool.jar和/lib/rt.jar已经从Java SE 9中删除

//报错代码
temp = Base64.decodeBase64(CutString(source, ckey_length));
//改用Base64.getDecoder()方法来获取Base64解码器,getBytes()方法将字符串转换为字节数组,
//最后调用decode()方法进行解码。
temp = Base64.getDecoder().decode(CutString(source, ckey_length).getBytes());
//报错代码2
return keyc + Base64.encodeBase64String(temp);
//用Base64.getEncoder()方法来获取编码器,并使用encode()方法将字节数组编码成Base64字符串。
return keyc + new String(Base64.getEncoder().encode(temp));

文章来源地址https://www.toymoban.com/news/detail-442830.html

到了这里,关于Cannot resolve method ‘decodeBase64‘ in ‘Base64‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 记一次诡异的Cannot find declaration to go to,Cannot resolve method

    记一次诡异的Cannot find declaration to go to,Cannot resolve method

    记一次诡异的 Cannot find declaration to go to, Cannot resolve method \\\'getOnExpressions\\\' in \\\'Join\\\' 对于项目中通常问题,清除缓存,重启idea,或者仔细检查语法通常都能解决问题,但是这次却失效了,以下是原因及解决方案。 项目中使用了mybatisplus的多租户拦截器,但是在拦截sql的时候却报

    2024年02月09日
    浏览(8)
  • Cannot resolve plugin org.springframework.boot:spring-boot-maven-plugin: 解决办法

    方法一 可能是你的镜像源的问题,查看你的maven安装目录下的 conf/setting.xml 的镜像源是否是国外地址还是说国内的一些镜像地址,国内的话下载会稳定点,如果不是国内的,请改成: 方法二 查看你的pom.xml文件里的spring-boot-maven-plugin部分是否有版本号,如果没有请加上: 方法

    2024年01月21日
    浏览(42)
  • springboot 出现 Cannot resolve MVC View ‘index‘ 问题解决办法,前后端不分离项目前端文件存放位置,已经如何访问

    springboot 出现 Cannot resolve MVC View ‘index‘ 问题解决办法,前后端不分离项目前端文件存放位置,已经如何访问

    简介:本文讲解,在springboot不分离的项目中,前端的文件存放的位置,和Cannot resolve MVC View ‘index‘ 这个报错怎么处理。 我们需要把 html 相关的页面放在 resource 的 templates 的下面,然后 js,css 相关的文件需要放在 static 下面 我现在想要访问这个 index.html ,需要注意的是 @Con

    2024年04月12日
    浏览(9)
  • Linux 用yum安装软件提示 cannot find a valid baseurl for repo:base/7/x86_64 的解决方法

    Linux 用yum安装软件提示 cannot find a valid baseurl for repo:base/7/x86_64 的解决方法

    如下: 出现这个问题是因为yum在安装包的过程中,虽然已经联网,但是没法解析远程包管理库对应的域名,所以我们只需要在网络配置中添加上DNS对应的ip地址即可。 vi /etc/sysconfig/network-scripts/ifcfg-ens33 或者 (看你们是配置的哪个名称,是ens33还是eht0 选择对应名字的命令即可

    2024年02月09日
    浏览(8)
  • cannot be resolved to absolute file path because it does not reside in the file system 问题解决

    cannot be resolved to absolute file path because it does not reside in the file system 问题解决

    在Springboot中利用Resource来获取文件并在前端返回该文件, 本地测试正常, 打包到远程报错: cannot be resolved to absolute file path because it does not reside in the file system 紧接上一个问题: 项目打包成 jar 后包无法读取src/main/resources下文件, 在Springboot打包之后, 无法读取到jar包内的文件, 因此

    2023年04月18日
    浏览(13)
  • 图片的编码存储与解码输出(基于Android将图片转Base64编码后再次解码会导致图片失真的解决办法)

    图片的编码存储与解码输出(基于Android将图片转Base64编码后再次解码会导致图片失真的解决办法)

    链接:https://pan.baidu.com/s/1hvVupGcCf1f41fizF08SNg?pwd=9988  提取码:9988 部分源码: 转Base64编码部分: 以上Android程序运行后会将图片的转为Base64编码进行存储,以下是图片转码后的结果。 下面是进行验证的php代码: 但是解码后输出后的照片出现了严重失真 数据量增加:Base64 编码

    2024年01月18日
    浏览(10)
  • cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not

    cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not

    JDK21 Spark3.5.0 使用JDK21做spark开发 启动代码出现 Exception in thread \\\"main\\\" java.lang.IllegalAccessError: class org.apache.spark.storage.StorageUtils$ (in unnamed module @0x461ad730) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x461ad730 报错信息 需要

    2024年02月02日
    浏览(37)
  • cannot resolve xxx 解决方法

    cannot resolve xxx 解决方法

    从git上拉了一个新项目,maven仓库都配置的没问题,但是无法从中央仓库里面download jar包, 报cannot resolve错误 经排查发现 打勾说明处于离线状态,所以无法从中央仓库中下载代码。 解决方法:把打勾去掉,这样就可以从中央仓库下载代码了

    2024年02月16日
    浏览(36)
  • IDEA 报 Cannot resolve symbol ‘HttpServletResponse‘ 解决

    IDEA 报 Cannot resolve symbol ‘HttpServletResponse‘ 解决

    springboot2版本换成springboot3之后,代码这里突然报红了, 首先要淡定,把原先Import的引入删掉,重新引入试试呢,是不是很简单哈哈。 原来,springboot3的路径是: import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; 而 springboot2的路径是: import javax.servle

    2024年02月10日
    浏览(9)
  • 解决IDEA创建项目时无法引入依赖问题:Cannot resolve **.**.**(已解决)

    解决IDEA创建项目时无法引入依赖问题:Cannot resolve **.**.**(已解决)

    今天在创建SpringBoot整合MyBatis项目时出现报错: Cannot resolve org.springframework:spring-tx:5.3.26 Cannot resolve org.mybatis:mybatis:3.5.11 Cannot resolve org.springframework:spring-jdbc:5.3.26 在网上查找了很多方法均不适用,开始以为又是版本的问题,可是一想SpringBoot中依赖的版本已经确定好了。 然后有

    2023年04月16日
    浏览(9)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包