|
|
@ -13,12 +13,13 @@ public class TestQrCord { |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成二维码,设置大小 |
|
|
|
* |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
public void test01() throws Exception { |
|
|
|
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(); |
|
|
|
File file = new File(WebConstant.UPLOAD_PATH_BASE + "/", fileName); |
|
|
|
if (!file.getParentFile().exists()) { |
|
|
@ -30,7 +31,7 @@ public class TestQrCord { |
|
|
|
out.write(codeByte); |
|
|
|
out.flush(); |
|
|
|
} finally { |
|
|
|
if ( out!= null) { |
|
|
|
if (out != null) { |
|
|
|
out.close(); |
|
|
|
} |
|
|
|
} |
|
|
@ -38,13 +39,16 @@ public class TestQrCord { |
|
|
|
|
|
|
|
/** |
|
|
|
* 测试压缩文件夹 |
|
|
|
* |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@Test |
|
|
|
public void test02() throws Exception { |
|
|
|
// 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"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|