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

java pdf,word,ppt转图片

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.8</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.test</groupId><artifactId>local-service</artifactId><version>0.0.1-SNAPSHOT</version><name>local-service</name><description>local-service</description><properties><java.version>8</java.version><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><scope>runtime</scope><optional>true</optional></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.13.0</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>2.0.32</version></dependency><!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-compress</artifactId><version>1.24.0</version></dependency><!--PDF操作工具包--><dependency><groupId>org.apache.pdfbox</groupId><artifactId>pdfbox-app</artifactId><version>2.0.16</version></dependency><!-- word操作工具包--><dependency><groupId>words</groupId><artifactId>aspose-words</artifactId><version>1.0.0</version></dependency><!-- ppt操作工具包--><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>4.1.2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>4.1.2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-scratchpad</artifactId><version>4.1.2</version></dependency><dependency><groupId>org.apache.xmlgraphics</groupId><artifactId>batik-bridge</artifactId><version>1.9.1</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build></project>
文件转换统一工具类 FileConvertUtil.java

调用 FileConvertUtil.convert2Images(filePath)即可输出图片信息

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.python.jline.internal.Log;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.Base64Utils;import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;/*** @author yangguang* @date 2023年11月01日 17:01*/
@Slf4j
public class FileConvertUtil {private static Map<String, BiFunction<String,String, List<ImageInfo>>> convertFactory = new HashMap<>();static {convertFactory.put("ppt", PPTUtil::ppt2image);convertFactory.put("pptx", PPTUtil::pptx2image);convertFactory.put("doc", WordUtil::word2image);convertFactory.put("docx", WordUtil::word2image);convertFactory.put("pdf", PdfUtil::pdf2image);}public static List<ImageInfo> convert2Images(String filePath) {File file = new File(filePath);String name = file.getName().substring(0,file.getName().lastIndexOf("."));String targetDir = file.getParentFile().getAbsolutePath()+File.separator+name;if(new File(targetDir).exists()){return Arrays.stream(new File(targetDir).listFiles()).map(File::getAbsolutePath).sorted((name1,name2)->Integer.compare(getFileIndex(name1),getFileIndex(name2))).map(FileConvertUtil::file2ImageInfo).collect(Collectors.toList());}else{new File(targetDir).mkdirs();}String suffix = filePath.substring(filePath.lastIndexOf(".") + 1);List<ImageInfo> list = Optional.ofNullable(convertFactory.get(suffix)).map(f -> f.apply(filePath,targetDir)).orElseThrow(() -> new CustomException("不支持得文件类型"));return list;}public static List<String> convert2ImagesBase64(String filePath) {return convert2Images(filePath).stream().map(ImageInfo::getPath).map(FileConvertUtil::base64Encoding).collect(Collectors.toList());}public static void clearWorkPath(File dir) {if (dir == null) {File file = new File(Constants.TEMP_PATH);for (File f : file.listFiles()) {clearWorkPath(f);}} else if (dir.isDirectory()) {for (File file : dir.listFiles()) {clearWorkPath(file);}dir.delete();} else {dir.delete();}}private static String base64Encoding(String imagePath) {InputStream in = null;try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {//建一个空的字节数组byte[] result = null;in = new FileInputStream(imagePath);byte[] buf = new byte[1024];//用来定义一个准备接收图片总长度的局部变量int len;//将流的内容读取到buf内存中while ((len = in.read(buf)) > 0) {//将buf内存中的内容从0开始到总长度输出出去out.write(buf, 0, len);}//将out中的流内容拷贝到一开始定义的字节数组中result = out.toByteArray();//通过util包中的Base64类对字节数组进行base64编码String base64 = Base64.getEncoder().encodeToString(result);return "data:Image/" + "PNG" + ";base64," + base64;} catch (Exception e) {log.error("image to base64 error",e);throw new CustomException("image to base64 error");}}private static int getFileIndex(String filePath){String fileName = new File(filePath).getName();return Integer.parseInt(fileName.substring(0,fileName.lastIndexOf(".")));}private static ImageInfo file2ImageInfo(String filePath) {ImageInfo.ImageInfoBuilder builder = ImageInfo.builder();BufferedImage img = null;File f = null;try {f = new File(filePath);img = ImageIO.read(f);return builder.width(img.getWidth()).height(img.getHeight()).path(filePath).build();}catch (IOException e) {log.error("读取文件失败",e);throw new CustomException("读取文件失败");}}}

图片对象ImageInfo.java

@Data
@Builder
public class ImageInfo {private String path;private Integer width;private Integer height;}
常量文件输出路径Constants.java
/*** @author yangguang* @date 2023年11月01日 15:35*/
public interface Constants {String CONF_PATH = System.getProperty("user.dir") + File.separator + "conf";String TEMP_PATH = System.getProperty("user.dir") + File.separator + "temp";
}

WordUtil.java

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.IntStream;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
import com.aspose.words.Document;
import com.aspose.words.ImageSaveOptions;
import com.aspose.words.SaveFormat;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.tomcat.util.http.fileupload.IOUtils;@Slf4j
public class WordUtil {/*** 验证aspose.word组件是否授权:无授权的文件有水印标记* 需要使用(aspose-words-15.8.0-jdk16.jar),版本要对应。无水印* @return*/private static boolean isWordLicense(){boolean result = false;try {String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes());com.aspose.words.License license = new com.aspose.words.License();license.setLicense(inputStream);result = true;} catch (Exception e) {e.printStackTrace();}return result;}//outputStream转inputStreamprivate static ByteArrayInputStream parse(OutputStream out) throws Exception{ByteArrayOutputStream baos = new ByteArrayOutputStream();baos = (ByteArrayOutputStream) out;ByteArrayInputStream swapStream = new ByteArrayInputStream(baos.toByteArray());return swapStream;}/*** word和txt文件转换图片* @param inputStream* @param* @return* @throws Exception*/private static List<BufferedImage> wordToImg(InputStream inputStream) throws Exception{if (!isWordLicense()){return null;}try {Date start = new Date();Document doc = new Document(inputStream);ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);options.setPrettyFormat(true);options.setUseAntiAliasing(true);options.setUseHighQualityRendering(true);int pageCount = doc.getPageCount();//生成前pageCount张,这可以限制输出长图时的页数(方法入参可以传值pageNum)/*if (pageCount > pageNum) {pageCount = pageNum;}*/List<BufferedImage> imageList = new ArrayList<BufferedImage>();for (int i = 0; i < pageCount; i++){OutputStream output = new ByteArrayOutputStream();options.setPageIndex(i);doc.save(output, options);ImageInputStream imageInputStream = javax.imageio.ImageIO.createImageInputStream(parse(output));imageList.add(javax.imageio.ImageIO.read(imageInputStream));}List<BufferedImage> imageList2 = new ArrayList<BufferedImage>();//这个重新生成新的图片是因为直接输出的图片底色为红色for(int j=0; j<imageList.size(); j++){// 生成新图片BufferedImage destImage = imageList.get(j);int w1 = destImage.getWidth();int h1 = destImage.getHeight();destImage = new BufferedImage(w1, h1, BufferedImage.TYPE_INT_RGB);Graphics2D g2 = (Graphics2D) destImage.getGraphics();g2.setBackground(Color.LIGHT_GRAY);g2.clearRect(0, 0, w1, h1);g2.setPaint(Color.RED);// 从图片中读取RGBint[] ImageArrayOne = new int[w1 * h1];ImageArrayOne = imageList.get(j).getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 逐行扫描图像中各个像素的RGB到数组中destImage.setRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGBimageList2.add(destImage);}Date end = new Date();long l=end.getTime()-start.getTime();long hour= l / (1000 * 60 * 60);long min=  (l-hour*(1000 * 60 * 60 ))/(1000* 60);long s= (l-hour*(1000 * 60 * 60 )-min*1000*60)/(1000);long ss= (l-hour*(1000 * 60 * 60 )-min*1000*60 -s*1000)/(1000/60);System.out.println("word转图片时间:"+min+"分"+s+"秒" + ss + "毫秒");//hour+"小时"+return imageList2;} catch (Exception e) {e.printStackTrace();throw e;}}/*** 合并任数量的图片成一张图片* @param isHorizontal true代表水平合并,fasle代表垂直合并* @param imgs 待合并的图片数组* @return* @throws IOException*/public static BufferedImage mergeImage(boolean isHorizontal, List<BufferedImage> imgs) throws IOException{// 生成新图片BufferedImage destImage = null;// 计算新图片的长和高int allw = 0, allh = 0, allwMax = 0, allhMax = 0;// 获取总长、总宽、最长、最宽for (int i = 0; i < imgs.size(); i++){BufferedImage img = imgs.get(i);allw += img.getWidth();if (imgs.size() != i + 1){allh += img.getHeight() + 5;} else {allh += img.getHeight();}if (img.getWidth() > allwMax){allwMax = img.getWidth();}if (img.getHeight() > allhMax){allhMax = img.getHeight();}}// 创建新图片if (isHorizontal){destImage = new BufferedImage(allw, allhMax, BufferedImage.TYPE_INT_RGB);} else {destImage = new BufferedImage(allwMax, allh, BufferedImage.TYPE_INT_RGB);}Graphics2D g2 = (Graphics2D) destImage.getGraphics();g2.setBackground(Color.LIGHT_GRAY);g2.clearRect(0, 0, allw, allh);g2.setPaint(Color.RED);// 合并所有子图片到新图片int wx = 0, wy = 0;for (int i = 0; i < imgs.size(); i++){BufferedImage img = imgs.get(i);int w1 = img.getWidth();int h1 = img.getHeight();// 从图片中读取RGBint[] ImageArrayOne = new int[w1 * h1];ImageArrayOne = img.getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 逐行扫描图像中各个像素的RGB到数组中if (isHorizontal) { // 水平方向合并destImage.setRGB(wx, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB} else { // 垂直方向合并destImage.setRGB(0, wy, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB}wx += w1;wy += h1 + 5;}return destImage;}public static List<ImageInfo> word2image(String wordPath,String targetDir){List<ImageInfo> list = Lists.newArrayList();File file = new File(wordPath);InputStream inStream =null;try {inStream = new FileInputStream(file);List<BufferedImage> wordToImg = wordToImg(inStream);IntStream.range(0,wordToImg.size()).forEach(i->{//可以保存图片(每页保存为一张)try {String filePath = (targetDir==null?Constants.TEMP_PATH:targetDir)+File.separator+ i +".png";BufferedImage image = wordToImg.get(i);ImageInfo imageInfo = ImageInfo.builder().width(image.getWidth()).height(image.getHeight()).path(filePath).build();ImageIO.write(image, "jpg", new File(filePath)); //将其保存在C:/imageSort/targetPIC/下synchronized (list){list.add(imageInfo);}}catch (Exception e){log.error("word2pdf error 212",e);}});}catch (Exception e){log.error("word2pdf error",e);}finally {IOUtils.closeQuietly(inStream);}return list;}// 测试工具类public static void main(String[] args){String path = "E:\\网页\\test.docx";new WordUtil().word2image(path,null);}}

PPTUtil.java

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.List;/*** @author yangguang* @date 2023年11月01日 16:11*/
@Slf4j
public class PPTUtil {private final static double IMAGE_SCALE = 8;public static List<ImageInfo> ppt2image(String pptPath, String targetDir){List<ImageInfo> list = Lists.newArrayList();InputStream is = null;HSLFSlideShow ppt = null;try {File file = new File(pptPath);is = new FileInputStream(file);ppt =new HSLFSlideShow(is);Dimension pgSize = ppt.getPageSize();int i=0;for (HSLFSlide slide : ppt.getSlides()) {ImageInfo imageInfo = toPNG(targetDir,pgSize.width, pgSize.height, slide,i);list.add(imageInfo);i++;}} catch (IOException e) {log.error("ppt转换图片失败,{}", e.getMessage());throw new RuntimeException("ppt转换图片失败" + e.getMessage());} finally {try {if (is != null) {is.close();}} catch (IOException e) {e.printStackTrace();}try {if (ppt != null) {ppt.close();}} catch (IOException e) {e.printStackTrace();}}return list;}public static List<ImageInfo> pptx2image(String pptPath,String targetDir){InputStream is = null;XMLSlideShow ppt = null;List<ImageInfo> list = Lists.newArrayList();try {is = new FileInputStream(pptPath);ppt = new XMLSlideShow(is);Dimension pgSize = ppt.getPageSize();int i=0;for (XSLFSlide slide : ppt.getSlides()) {ImageInfo imageInfo = toPNG(targetDir,pgSize.width, pgSize.height, slide,i);list.add(imageInfo);i++;}} catch (IOException e) {log.error("pptx转换图片失败,{}", e.getMessage());throw new RuntimeException("pptx转换图片失败" + e.getMessage());} finally {try {if (is != null) {is.close();}} catch (IOException e) {e.printStackTrace();}try {if (ppt != null) {ppt.close();}} catch (IOException e) {e.printStackTrace();}}return list;}private static ImageInfo toPNG(String targetDir,int pgWidth, int pgHeight, Slide slide,int i) throws IOException {int imageWidth = (int) Math.floor(IMAGE_SCALE * pgWidth);int imageHeight = (int) Math.floor(IMAGE_SCALE * pgHeight);BufferedImage img = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);Graphics2D graphics = img.createGraphics();graphics.setPaint(Color.white);graphics.fill(new Rectangle2D.Float(0, 0, pgWidth, pgHeight));graphics.scale(IMAGE_SCALE, IMAGE_SCALE);slide.draw(graphics);// save the outputString filePath = (targetDir==null?Constants.TEMP_PATH:targetDir)+ File.separator+ i +".png";ImageInfo imageInfo = ImageInfo.builder().width(img.getWidth()).height(img.getHeight()).path(filePath).build();ImageIO.write(img, "jpg", new File(filePath));return imageInfo;}public static void main(String[] args) {new PPTUtil().ppt2image("E:\\网页test.ppt",null);}
}

PdfUtil.java

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.springframework.stereotype.Component;import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.stream.IntStream;/*** @author yangguang* @date 2022年12月20日 9:56*/
@Component
@Slf4j
public class PdfUtil {private static ImageInfo pdftoimageByNum(PDFRenderer renderer, Integer pageNum, String imagePath)throws IOException{BufferedImage image = renderer.renderImageWithDPI(pageNum-1, 296);//image = FileUtil.bufferedImage2Transparent(image);//          BufferedImage image = renderer.renderImage(i, 2.5f);File file1 = new File(imagePath);if(!file1.getParentFile().exists()){file1.getParentFile().mkdirs();}ImageInfo imageInfo = ImageInfo.builder().width(image.getWidth()).height(image.getHeight()).path(imagePath).build();ImageIO.write(image, "PNG", new File(imagePath));return imageInfo;}private static String getFileName(String filepath) {String fileName;filepath = filepath.replaceAll("\\\\",File.separator);if(filepath.contains(File.separator)){fileName = filepath.substring(filepath.lastIndexOf(File.separator) + 1);}else{fileName = filepath;}if(!fileName.endsWith(".pdf")){throw new CustomException("文件格式不正确");}return fileName.substring(0,fileName.lastIndexOf("."));}public static List<ImageInfo> pdf2image(String pdfPath,String targetDir){List<ImageInfo> list = Lists.newArrayList();File file = new File(pdfPath);PDDocument doc=null;try {doc = PDDocument.load(file);PDFRenderer renderer = new PDFRenderer(doc);int pageCount = doc.getNumberOfPages();IntStream.range(0,pageCount).forEach(i->{try {String imagePath = (targetDir==null?Constants.TEMP_PATH:targetDir)+File.separator+ i + ".png";ImageInfo imageInfo = pdftoimageByNum(renderer, i + 1, imagePath);synchronized (list){list.add(imageInfo);}}catch (Exception e){log.error("转换图片失败",e);}});} catch (IOException e) {log.error("转换失败,io异常",e);throw new CustomException("转换失败,io异常");}finally {try {doc.close();} catch (Exception e) {log.error("io异常",e);}}return list;}public static void main(String[] args){List<ImageInfo> a = new PdfUtil().pdf2image("C:\\test.pdf",null);System.out.println(a);}
}

相关文章:

java pdf,word,ppt转图片

pom.xml <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://maven.apache.org/POM/4.0.0…...

map set

目录 一、关联式容器 二、键值对 三、树形结构的关联式容器 3.1 set 3.1.1 set的介绍 3.1.2 set的使用 3.2 multiset 3.2.1 multiset的介绍 3.2.2 multiset的使用 3.3 map 3.3.1 map的介绍 3.3.2 map的使用 …...

Fourier分析导论——第3章——Fourier级数的收敛性(E.M. Stein R. Shakarchi)

第 3 章 Fourier级数的收敛性(Convergence of Fourier Series) The sine and cosine series, by which one can represent an arbitrary function in a given interval, enjoy among other remarkable properties that of being convergent. This property did not escape…...

解决ruoyi-vue部署到域名子路径静态资源404

参考ruoyi前端手册...

游戏引擎中为什么要用四元数表示旋转而不用欧拉角旋转?

个人观点&#xff0c;仅供参考&#xff0c;如有错误可太刺激了 四元数的简单概念和使用 欧拉角通常用于表示一个物体的旋转状态&#xff0c;而不是表示旋转过程。 欧拉角描述的是物体相对于某个参考坐标系的朝向或旋转状态&#xff0c;通常以不同的轴&#xff08;例如&#x…...

E-Office(泛微OA)前台任意文件读取漏洞复现

简介 泛微E-Office是一款企业级的全流程办公自动化软件&#xff0c;它包括协同办公、文档管理、知识管理、工作流管理等多个模块&#xff0c;涵盖了企业日常工作中的各个环节。在该产品前台登录页存在文件读取漏洞。 officeserver.php文件存在任意文件读取漏洞&#xff0c;通…...

前端小案例 | 喵喵大王立大功 | 一个带便利贴功能的todolist面板

文章目录 &#x1f4da;html&#x1f4da;css&#x1f4da;js&#x1f407;stickynote.js&#x1f407;todolist.js&#x1f407;clock.js &#x1f4da;html <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><m…...

算法训练营第十一天 | 20. 有效的括号、 1047. 删除字符串中的所有相邻重复项、150. 逆波兰表达式求值

目录&#xff1a; 力扣 20. 有效的括号力扣 1047. 删除字符串中的所有相邻重复项力扣 150. 逆波兰表达式求值 问题一、 20. 有效的括号 题目链接&#xff1a;20. 有效的括号 - 力扣&#xff08;LeetCode&#xff09; 思路分析&#xff1a; 很多朋友刚开始接触这一类题的时候…...

Python unittest单元测试框架 TestSuite测试套件

TestSuite 测试套件简介 对一个功能的验证往往是需要很多多测试用例&#xff0c;可以把测试用例集合在一起执行&#xff0c;这就产生了测试套件TestSuite 的概念&#xff0c;它是用来组装单个测试用例&#xff0c;规定用例的执行的顺序&#xff0c;而且TestSuite也可以嵌套Tes…...

FSB逮捕为乌克兰网络部队工作的俄罗斯黑客

导语 近日&#xff0c;俄罗斯联邦安全局&#xff08;FSB&#xff09;逮捕了两名涉嫌协助乌克兰网络部队对俄罗斯重要基础设施目标进行网络攻击的个人。这起事件引起了广泛关注&#xff0c;涉及到了网络安全和国际关系等多个领域。本文将为您详细介绍这一事件的背景和最新进展。…...

【PC电脑windows-学习样例tusb_serial_device-ESP32的USB模拟串口程序+VScode建立工程+usb组件添加+-基础样例学习】

【PC电脑windows-学习样例tusb_serial_device-ESP32的USB模拟串口程序-基础样例学习】 1、概述2、实验环境3-1、 物品说明3-2、所遇问题&#xff1a;ESP32 cannot open source file "tinyusb.h"或者“tinyusb.h:No such file or directory ....”3-3、解决问题&#…...

LeetCode75——Day26

文章目录 一、题目二、题解 一、题目 394. Decode String Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guar…...

面试算法53:二叉搜索树的下一个节点

题目 给定一棵二叉搜索树和它的一个节点p&#xff0c;请找出按中序遍历的顺序该节点p的下一个节点。假设二叉搜索树中节点的值都是唯一的。例如&#xff0c;在图8.9的二叉搜索树中&#xff0c;节点8的下一个节点是节点9&#xff0c;节点11的下一个节点是null。 分析&#xf…...

2023SHCTF web方向wp

1.ezphp 看一眼&#xff0c;你大爷&#xff0c;啥玩意都给我过滤完了。 还好下面有preg_replace()/e&#xff0c;会把replacement当作php语句执行 传参pattern.*&#xff0c; .*表示任意字符&#xff0c;code{${phpinfo()}} &#xff0c;为什么这样写&#xff0c;因为,print_…...

从物理磁盘到数据库 —— 存储IO链路访问图

原图来自&#xff1a;数据库IO链路访问图 – OracleBlog 由于很复杂&#xff0c;为了加深理解自己重新画了一次&#xff0c;另外参考其他文档补充了各部分的插图和介绍。 一、 存储服务器 1. 物理磁盘 外层的壳子称为硬盘笼 cage 2. chunklet Chunklet 是一个虚拟概念而不是实…...

基于java+springboot+vue在线选课系统

项目介绍 本系统结合计算机系统的结构、概念、模型、原理、方法&#xff0c;在计算机各种优势的情况下&#xff0c;采用JAVA语言&#xff0c;结合SpringBoot框架与Vue框架以及MYSQL数据库设计并实现的。员工管理系统主要包括个人中心、课程管理、专业管理、院系信息管理、学生…...

GO学习之 同步操作sync包

GO系列 1、GO学习之Hello World 2、GO学习之入门语法 3、GO学习之切片操作 4、GO学习之 Map 操作 5、GO学习之 结构体 操作 6、GO学习之 通道(Channel) 7、GO学习之 多线程(goroutine) 8、GO学习之 函数(Function) 9、GO学习之 接口(Interface) 10、GO学习之 网络通信(Net/Htt…...

NUUO网络摄像头(NVR)RCE漏洞复现

简介 NUUO Network Video Recorder&#xff08;NVR&#xff09;是中国台湾NUUO公司的一款网络视频记录器。 NUUO NVR视频存储管理设备的__debugging_center_utils___.php文件存在未授权远程命令执行漏洞&#xff0c;攻击者可在没有任何权限的情况下通过log参数执行任意命令。…...

一款快速获取目标网站关键信息的工具

1.摘要 今天要介绍的这款工具是一个快速收集网站信息的开源脚本, 采用Python语言编写, 该工具可以快速收集网站的页面标题、网站上次更新日期、DNS信息、子域、防火墙名称、网站使用的技术栈、证书等信息, 默认支持对验证码和JavaScript内容执行绕过操作。 2.工具安装使用 使…...

将GC编程语言引入WebAssembly的新方法

本文讨论了一种名为 WasmGC 的新方法&#xff0c;用于将垃圾收集编程语言有效地引入 WebAssembly。 WasmGC 定义了新的 GC 类型&#xff0c;例如结构和数组&#xff0c;与之前编译为线性内存的方法 (WasmMVP) 相比&#xff0c;它们可以实现更好的优化&#xff1a; 在编译时和…...

铭豹扩展坞 USB转网口 突然无法识别解决方法

当 USB 转网口扩展坞在一台笔记本上无法识别,但在其他电脑上正常工作时,问题通常出在笔记本自身或其与扩展坞的兼容性上。以下是系统化的定位思路和排查步骤,帮助你快速找到故障原因: 背景: 一个M-pard(铭豹)扩展坞的网卡突然无法识别了,扩展出来的三个USB接口正常。…...

零门槛NAS搭建:WinNAS如何让普通电脑秒变私有云?

一、核心优势&#xff1a;专为Windows用户设计的极简NAS WinNAS由深圳耘想存储科技开发&#xff0c;是一款收费低廉但功能全面的Windows NAS工具&#xff0c;主打“无学习成本部署” 。与其他NAS软件相比&#xff0c;其优势在于&#xff1a; 无需硬件改造&#xff1a;将任意W…...

SkyWalking 10.2.0 SWCK 配置过程

SkyWalking 10.2.0 & SWCK 配置过程 skywalking oap-server & ui 使用Docker安装在K8S集群以外&#xff0c;K8S集群中的微服务使用initContainer按命名空间将skywalking-java-agent注入到业务容器中。 SWCK有整套的解决方案&#xff0c;全安装在K8S群集中。 具体可参…...

FastAPI 教程:从入门到实践

FastAPI 是一个现代、快速&#xff08;高性能&#xff09;的 Web 框架&#xff0c;用于构建 API&#xff0c;支持 Python 3.6。它基于标准 Python 类型提示&#xff0c;易于学习且功能强大。以下是一个完整的 FastAPI 入门教程&#xff0c;涵盖从环境搭建到创建并运行一个简单的…...

MMaDA: Multimodal Large Diffusion Language Models

CODE &#xff1a; https://github.com/Gen-Verse/MMaDA Abstract 我们介绍了一种新型的多模态扩散基础模型MMaDA&#xff0c;它被设计用于在文本推理、多模态理解和文本到图像生成等不同领域实现卓越的性能。该方法的特点是三个关键创新:(i) MMaDA采用统一的扩散架构&#xf…...

AI编程--插件对比分析:CodeRider、GitHub Copilot及其他

AI编程插件对比分析&#xff1a;CodeRider、GitHub Copilot及其他 随着人工智能技术的快速发展&#xff0c;AI编程插件已成为提升开发者生产力的重要工具。CodeRider和GitHub Copilot作为市场上的领先者&#xff0c;分别以其独特的特性和生态系统吸引了大量开发者。本文将从功…...

智能仓储的未来:自动化、AI与数据分析如何重塑物流中心

当仓库学会“思考”&#xff0c;物流的终极形态正在诞生 想象这样的场景&#xff1a; 凌晨3点&#xff0c;某物流中心灯火通明却空无一人。AGV机器人集群根据实时订单动态规划路径&#xff1b;AI视觉系统在0.1秒内扫描包裹信息&#xff1b;数字孪生平台正模拟次日峰值流量压力…...

【数据分析】R版IntelliGenes用于生物标志物发现的可解释机器学习

禁止商业或二改转载&#xff0c;仅供自学使用&#xff0c;侵权必究&#xff0c;如需截取部分内容请后台联系作者! 文章目录 介绍流程步骤1. 输入数据2. 特征选择3. 模型训练4. I-Genes 评分计算5. 输出结果 IntelliGenesR 安装包1. 特征选择2. 模型训练和评估3. I-Genes 评分计…...

佰力博科技与您探讨热释电测量的几种方法

热释电的测量主要涉及热释电系数的测定&#xff0c;这是表征热释电材料性能的重要参数。热释电系数的测量方法主要包括静态法、动态法和积分电荷法。其中&#xff0c;积分电荷法最为常用&#xff0c;其原理是通过测量在电容器上积累的热释电电荷&#xff0c;从而确定热释电系数…...

网站指纹识别

网站指纹识别 网站的最基本组成&#xff1a;服务器&#xff08;操作系统&#xff09;、中间件&#xff08;web容器&#xff09;、脚本语言、数据厍 为什么要了解这些&#xff1f;举个例子&#xff1a;发现了一个文件读取漏洞&#xff0c;我们需要读/etc/passwd&#xff0c;如…...