# tomato **Repository Path**: wangzh991122/tomato ## Basic Information - **Project Name**: tomato - **Description**: 积累生活中遇到的工具类,简化代码操作 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-08 - **Last Updated**: 2021-12-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ##1.tomato-common 存放一些通用类,例如通用异常等等 ##2.tomato-zip-springboot-starter 压缩包启动器,目前支持市面上常用压缩包格式例如:zip rar 7z tar等 下面为部分用法: ```java package com.tomato.test; import com.tomato.zip.enums.ZipType; import com.tomato.zip.factory.ZipFactory; import com.tomato.zip.service.BaseZip; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.io.File; import java.util.ArrayList; import java.util.List; /** * 压缩包测试 */ @Slf4j @SpringBootTest(classes = TestApplication.class) public class ZipTest { @Autowired private ZipFactory zipFactory; /** * 创建zip,如果不需要密码则可以直接设为null */ @Test public void testCreateWithPassword() { BaseZip baseZip = zipFactory.getZip(ZipType.ZIP); List list = new ArrayList() {{ add(new File("e:/hello.txt")); add(new File("e:/abc.txt")); }}; baseZip.compress(new File("e:/a.zip"), "123432", list); } /** * 解压 如果不需要密码则可以直接设为null */ @Test public void testExtractAll() { BaseZip baseZip = zipFactory.getZip(ZipType.ZIP); baseZip.extractAll(new File("e:/a.zip"),"123345", "e:/opt"); } /** * 往压缩包里面添加文件 如果不需要密码则可以直接设为null */ @Test public void testAddFile() { BaseZip baseZip = zipFactory.getZip(ZipType.ZIP); baseZip.addFile(new File("e:/a.zip"),"123432", new File("e:/c.txt")); } } ```