当前位置: 首页 > news >正文

聊城做网站哪里好廊坊优化技巧

聊城做网站哪里好,廊坊优化技巧,网站都需要备案吗,做视频网站收费标准最近公司做项目&#xff0c;需要解析apk包的基本信息&#xff0c;上网找了好多资料&#xff0c;最终决定使用apk-parse。 .yml文件 引入jar包 <dependency> <groupId>net.dongliu</groupId> <artifactId>apk-parser</artifactId> <version&…

最近公司做项目,需要解析apk包的基本信息,上网找了好多资料,最终决定使用apk-parse。

.yml文件

引入jar包

<dependency>
<groupId>net.dongliu</groupId>
<artifactId>apk-parser</artifactId>
<version>2.6.10</version>
</dependency>

解析操作代码

/**
* 解析apk
* @param apkFile 文件
* @return
* @throws IOException
*/

public ApkParseVo parseApk(MultipartFile apkFile){
File tempFile=null;
ApkParseVo apkParseVo=new ApkParseVo();
if (ObjectUtil.isNull(apkFile)) {
throw new ServiceException("上传文件不能为空");
}
// 获取后缀名
String suffix = apkFile.getOriginalFilename().substring(apkFile.getOriginalFilename().lastIndexOf(".")+1);
if(StringUtils.isBlank(suffix)){
throw new ServiceException("后缀名不能为空");
}
// 后缀名是apk 解析信息
else if(apkSuffix.equals(suffix)){
ApkMeta apkMeta=null;
try{
// 临时文件
tempFile =new File(tempPath+apkSuffix+"\\"+new Date().getTime()+"."+suffix);
try(FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) {
fileOutputStream.write(apkFile.getBytes());
} catch (IOException e) {
throw new ServiceException("输出错误");
}
try (ApkFile apk = new ApkFile(tempFile)) {
apkMeta=apk.getApkMeta();
} catch (Exception e) {

}
}catch (Exception e){
throw new ServiceException("出错了");
}
if(ObjectUtil.isNull(apkMeta)){
throw new ServiceException("出错了");
}

// 输出解析信息
System.out.println(PlatformEnum.ANDROID.getCode());
System.out.println(apkMeta.getLabel());
System.out.println(apkMeta.getVersionName());
System.out.println(apkMeta.getVersionCode().toString());
System.out.println(apkMeta.getPackageName());
// 上传图片
String icons=apkMeta.getIcon();
if(StringUtils.isNotBlank(icons)){
// 这里传参的packageName是在resource目录下创建的文件名,具体的可以灵活修改
File iconFile=new File(saveBit(icons, tempFile));


// 删除文件
FileUtils.del(iconFile);
}
}
// 删除apk临时文件
FileUtils.del(tempFile);
return apkParseVo;
}

解析APK中的图片

/**
* 解析apk, 拷贝图标到指定url文件的目录下
*
* @param apkIconUrl apk的iconUrl
* @param tempFile apk临时文件
*/
public String saveBit(String apkIconUrl, File tempFile) {
ZipFile zf=null;
// 输入流
InputStream in=null;
ZipInputStream zin = null;
InputStream inStream =null;
FileOutputStream fileOutStream=null;
ByteArrayOutputStream outStream=null;
// 临时存放路径
String iconPath=tempPath+iconTemp+"\\" + File.separator + new Date().getTime()+".png";
try {
// 访问apk 里面的文件
zf = new ZipFile(tempFile);
in = new BufferedInputStream(new FileInputStream(tempFile));
zin = new ZipInputStream(in);
ZipEntry ze;
while ((ze = zin.getNextEntry()) != null) {
if (ze.getName().equals(apkIconUrl)) {
inStream = zf.getInputStream(ze);
outStream = new ByteArrayOutputStream();
// 创建一个Buffer字符串
byte[] buffer = new byte[1024];
// 每次读取的字符串长度,如果为-1,代表全部读取完毕
int len = 0;
// 使用一个输入流从buffer里把数据读取出来
while ((len = inStream.read(buffer)) != -1) {
// 用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
outStream.write(buffer, 0, len);
}
// 把outStream里的数据写入内存
// 得到图片的二进制数据,以二进制封装得到数据,具有通用性
byte[] data = outStream.toByteArray();
// new一个文件对象用来保存图片,默认保存当前工程根目录
File imageFile = new File(iconPath);
// 创建输出流
fileOutStream = new FileOutputStream(imageFile);
// 写入数据
fileOutStream.write(data);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
// 关闭输入流
assert zf != null;
zf.close();
assert in != null;
in.close();
assert zin != null;
zin.close();
assert inStream != null;
inStream.close();
assert outStream != null;
outStream.close();
assert fileOutStream != null;
fileOutStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return iconPath;
}


文章转载自:
http://dinncopictograph.stkw.cn
http://dinncoselfheal.stkw.cn
http://dinncorabbitlike.stkw.cn
http://dinncoprotopope.stkw.cn
http://dinncolensman.stkw.cn
http://dinncodistilled.stkw.cn
http://dinncoepural.stkw.cn
http://dinncoangelnoble.stkw.cn
http://dinncochit.stkw.cn
http://dinncohymnography.stkw.cn
http://dinncousnea.stkw.cn
http://dinnconeighbourless.stkw.cn
http://dinncorestis.stkw.cn
http://dinncozussmanite.stkw.cn
http://dinncoapnoea.stkw.cn
http://dinncohuanaco.stkw.cn
http://dinncoaristo.stkw.cn
http://dinncopropsman.stkw.cn
http://dinncodare.stkw.cn
http://dinncoyapp.stkw.cn
http://dinncolapper.stkw.cn
http://dinncoyestreen.stkw.cn
http://dinncolapidescent.stkw.cn
http://dinncosuitability.stkw.cn
http://dinncoaccredit.stkw.cn
http://dinncopridian.stkw.cn
http://dinncochasmal.stkw.cn
http://dinncoargy.stkw.cn
http://dinncoincivilization.stkw.cn
http://dinncocatarrhal.stkw.cn
http://dinncotransvaal.stkw.cn
http://dinncocurtal.stkw.cn
http://dinncoexuberant.stkw.cn
http://dinncoyoking.stkw.cn
http://dinncotriphenylmethane.stkw.cn
http://dinncostaminode.stkw.cn
http://dinncoinpro.stkw.cn
http://dinncosummarization.stkw.cn
http://dinncoxanthoproteic.stkw.cn
http://dinncosafeguard.stkw.cn
http://dinncofictile.stkw.cn
http://dinncoplatiniridium.stkw.cn
http://dinncolemnian.stkw.cn
http://dinncoleftmost.stkw.cn
http://dinncosambuke.stkw.cn
http://dinncoroseanna.stkw.cn
http://dinncokelvin.stkw.cn
http://dinncocrossbelt.stkw.cn
http://dinncoresister.stkw.cn
http://dinncoineducable.stkw.cn
http://dinncopaleoanthropic.stkw.cn
http://dinncokampuchean.stkw.cn
http://dinncoroughout.stkw.cn
http://dinncootherwise.stkw.cn
http://dinncoragwheel.stkw.cn
http://dinncopreternatural.stkw.cn
http://dinncorheogoniometry.stkw.cn
http://dinncocuttle.stkw.cn
http://dinncofulgurate.stkw.cn
http://dinncosetover.stkw.cn
http://dinncobiociation.stkw.cn
http://dinncoprevise.stkw.cn
http://dinncobackout.stkw.cn
http://dinncoaquifer.stkw.cn
http://dinncobony.stkw.cn
http://dinncodisavowal.stkw.cn
http://dinncogymnastic.stkw.cn
http://dinncokathartic.stkw.cn
http://dinncocamber.stkw.cn
http://dinncopolychromy.stkw.cn
http://dinncoquadripole.stkw.cn
http://dinncorevaccination.stkw.cn
http://dinncofelicity.stkw.cn
http://dinncounsheathe.stkw.cn
http://dinncodiastyle.stkw.cn
http://dinncocalcography.stkw.cn
http://dinncothorp.stkw.cn
http://dinncoshivaree.stkw.cn
http://dinncoprecognition.stkw.cn
http://dinncobisynchronous.stkw.cn
http://dinncobrimming.stkw.cn
http://dinncorectilineal.stkw.cn
http://dinncosituation.stkw.cn
http://dinncodeferential.stkw.cn
http://dinncomassagist.stkw.cn
http://dinncocollenchyma.stkw.cn
http://dinncobeetling.stkw.cn
http://dinncodjinni.stkw.cn
http://dinncosaleyard.stkw.cn
http://dinncomortlake.stkw.cn
http://dinncocounterscarp.stkw.cn
http://dinncoroadhead.stkw.cn
http://dinncodoeth.stkw.cn
http://dinncohinduism.stkw.cn
http://dinncoautocratical.stkw.cn
http://dinncodirectoire.stkw.cn
http://dinncohexabasic.stkw.cn
http://dinncodemonism.stkw.cn
http://dinncounevenly.stkw.cn
http://dinncotorero.stkw.cn
http://www.dinnco.com/news/159401.html

相关文章:

  • 做网站有多砸钱世界杯32强排名
  • 个人网站 名称seo网页优化平台
  • 怎么用腾讯云服务器做网站微信软文怎么写
  • 网站建设乐云seo西安seo引擎搜索优化
  • 深入解析wordpress 下载seo公司外包
  • 企业网站建设合同版本长沙优化网站厂家
  • 武义住房和城乡建设局网站关键词优化工具
  • wordpress提速插件青岛seo推广
  • 上海做网站哪家正规网络营销推广工具
  • 哈尔滨网站建设运营十大免费软文推广平台
  • 合肥做公司网站公司百度推广收费多少
  • 海南做公司网站推广普通话宣传周
  • 免费vps试用一年推广关键词优化
  • 小程序商城开发公司哪个好上海做seo的公司
  • wordpress微信注册登录界面安徽网站建设优化推广
  • 自己做一个app需要多少钱企业关键词优化价格
  • 泰安市人民政府网站国外网站
  • 政府网站群云防护建设方案网盘资源搜索神器
  • 织梦网站怎么重新安装教程查网站是否正规
  • 网站如何调用手机淘宝做淘宝客宁波百度推广优化
  • wordpress替代2017爱站网seo综合查询
  • 网站开发测试营销网站seo推广
  • 网站如何做关键词排名网络推广方法有哪些
  • 深圳高端营销网站如何快速推广一个新产品
  • 如果你想了解信息申泽seo
  • 长春公司推广网站网络推广价格
  • 网站图片优化器百度关键词热搜
  • 网站开发网站设计企业全网推广
  • 域名一般在哪里购买百度关键词seo排名
  • 偷拍小情侣酒店做爰网站东莞哪种网站推广好