Browse Source

0316.0

master
zhangye 5 years ago
parent
commit
a04d3f5193
  1. 10
      util/src/test/java/com/ccsens/util/TestQrCord.java

10
util/src/test/java/com/ccsens/util/TestQrCord.java

@ -13,12 +13,13 @@ public class TestQrCord {
/** /**
* 生成二维码设置大小 * 生成二维码设置大小
*
* @throws Exception * @throws Exception
*/ */
@Test @Test
public void test01() throws Exception { public void test01() throws Exception {
String fileName = "zzz/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png"; String fileName = "zzz/" + DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
ByteArrayOutputStream stream = QRCode.from("112233").to(ImageType.BMP).withSize(1000,1000).stream(); ByteArrayOutputStream stream = QRCode.from("112233").to(ImageType.BMP).withSize(1000, 1000).stream();
byte[] codeByte = stream.toByteArray(); byte[] codeByte = stream.toByteArray();
File file = new File(WebConstant.UPLOAD_PATH_BASE + "/", fileName); File file = new File(WebConstant.UPLOAD_PATH_BASE + "/", fileName);
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
@ -30,7 +31,7 @@ public class TestQrCord {
out.write(codeByte); out.write(codeByte);
out.flush(); out.flush();
} finally { } finally {
if ( out!= null) { if (out != null) {
out.close(); out.close();
} }
} }
@ -38,13 +39,16 @@ public class TestQrCord {
/** /**
* 测试压缩文件夹 * 测试压缩文件夹
*
* @throws Exception * @throws Exception
*/ */
@Test @Test
public void test02() throws Exception { public void test02() throws Exception {
// ZipUtil.gzip(new File("F:\\home\\cloud\\tall\\uploads\\zzz")); // ZipUtil.gzip(new File("F:\\home\\cloud\\tall\\uploads\\zzz"));
ZipUtil.zip("F:\\home\\cloud\\tall\\uploads\\zzz","F:\\home\\cloud\\tall\\uploads\\zzz.zip"); ZipUtil.zip("F:\\home\\cloud\\tall\\uploads\\zzz", "F:\\home\\cloud\\tall\\uploads\\zzz.zip");
} }
} }

Loading…
Cancel
Save