- 浏览: 103269 次
- 性别:
- 来自: 深圳
-
文章分类
- 全部博客 (209)
- http://docs.jpush.io/server/java_sdk/ (1)
- SpingMVC ModelAndView (1)
- Model (1)
- Control以及参数传递 (1)
- https://www.alipay.com/ (1)
- 检查指定的字符串列表是否不为空。 (1)
- 转自http://my.oschina.net/rpgmakervx/blog/505434 (1)
- 压缩js (1)
- 含包含 字母数字校验 (1)
- 判断浏览器是ie (1)
- fixbox (0)
- 转自http://www.cnblogs.com/lanzi/archive/2010/10/26/1861338.html (1)
- http://dl2.iteye.com/upload/attachment/0113/2406/afbd8d53-dcad-3afc-8d78-41c1591 (0)
- IDEA (0)
- maven搭建 (0)
- http://www.jeasyuicn.com/api/docTtml/index.htm (1)
- 给tomcat添加运行内存: (1)
- JPUSH推送 (1)
- requestScope (0)
- oracle中plsql安装client10连接数据库 (1)
- 不需要安装oracle11g (1)
- tuikuan (1)
- http://www.hjxmall.com/index.php (1)
- java (1)
- 参考 (1)
- xml签名验签模拟程序 (1)
- 技术网站收集分享 (1)
- Java NIO提供了与标准IO不同的IO工作方式 ------来源于 http://www.iteye.com/magazines/132-Java-NIO (1)
- oracle表查询语句优化 (0)
- oracle (5)
- a (1)
- TenpayHttpClient (2)
- mongodb (1)
- http://www.qcloud.com/product/cmongo.html?utm_source=pcsem1&utm_medium=bdgj46&utm_campaign=baidu (1)
- SpringMVC整合MongoDB开发 (0)
- SpringMVC整合MongoDB开发 https://www.mongodb.org (1)
- Java 语言中常见问题总结 (1)
- 数据库SQL优化大总结 (1)
- 拦截器与过滤器的区别 (1)
- Struts2中拦截器与过滤器的区别及执行顺序 (1)
- Spring声明式事务管理与配置 (0)
- oracle OPERTION (1)
- java 高并发多线程开发 (1)
- Collection 与 map 接口相关集合 (1)
- 多线程开发实践 (1)
- JVM调优总结 转自 http://www.importnew.com/18694.html (1)
- redis 五种数据类型的使用场景 转自于 http://blog.csdn.net/gaogaoshan/article/details/41039581 (1)
- HttpWatch http基础 来自于http://blog.csdn.net/gaogaoshan/article/details/21237555 (1)
- maven 远程仓库 http://blog.csdn.net/gaogaoshan/article/details/40266779 (1)
- 生成Webservice客户端的4中方法 http://blog.csdn.net/gaogaoshan/article/details/8980775 (1)
- http://fgh2011.iteye.com/blog/1564283 (1)
- sleep和wait有什么区别 http://xiaowei2002.iteye.com/blog/2174188 (1)
- JDK中常用包及其类 常见的几种RuntimeException (1)
- Java的运行原理 (1)
- mybatis缓存的使用及理解 http://my.oschina.net/dxqr/blog/123163 (1)
- 软件架构设计分析 (1)
- redis技术总结 (3)
- java面试总结知识点 (1)
- ZooKeeper技术 (1)
- Hadoop (1)
- sso单点登录 (1)
- SpringIOC (1)
- 书签ssssssssssssssssssssss (1)
- spring事务的隔离级别 http://www.cnblogs.com/yangy608/archive/2011/06/29/2093478.html (1)
- 秒杀系统架构分析与实战 http://www.importnew.com/18920.html (1)
- oracle 连接plsql配置 (1)
- maven工程集成springmvc http://blog.csdn.net/fox_lht/article/details/16952683 (1)
- java类序列化与反序列化版本唯一号serialVersionUID (1)
- spring注解用法总结 (1)
- eclipse导入maven项目找不到资源文件方法 (1)
- dubbo (0)
- socket 网络编程 服务器与客户端 编程 (1)
- Thread与Runnable实现线程利用线程插队实现求和操作 (1)
- 生产者与消费者模式 (1)
- JAXB注解 java 关于xml的注解,自动生成xml文件 - @XML*** (1)
- xml 与JAVAbean转换 (1)
- MAP (2)
- decimalToString (1)
- 反编译插件 (0)
- 反编译插件 https://sourceforge.net/projects/jadclipse/?source=typ_redirect (1)
- AWX (1)
- 官网地址Dinp (1)
- public interface ExecutorService extends Executor (1)
- MAIN (1)
- 转自于 http://blog.csdn.net/lufeng20/article/details/24314381 (1)
- JaxbUtil (1)
- HttpXmlClient (0)
- Http post 请求 (1)
- URLDecoder (1)
- spdb (0)
- 订单号生成规则 (1)
- 距离0点毫秒数 (1)
- MyBatis存储过程调用java (1)
- Banks (1)
- 学习网址 (1)
- hots配置oracle数据库配置修改 (1)
- 支付宝文档 (1)
- Jadclipse (1)
- filter (0)
- Filter过滤器 (1)
- 工具类 fixbox (1)
- java quartz (0)
- java quartz 实现定时任务,每个礼拜一到礼拜五定时执行 (1)
- Thread (4)
- getResourceAsStream (1)
- BigData (1)
- 开源架构 (17)
- 架构 (0)
- 文件操作 (2)
- tools (20)
- 测试工具 (1)
- vm (1)
- mq (1)
- blog (1)
- 开源架构搭建技术 (6)
- JAVA细节技术点总结 (1)
- 优化技术 (1)
- LINUX命令使用 (1)
- spring (2)
- 大数据 (1)
- struts2 (1)
- python (1)
- pay (1)
- linux (1)
- 压力测试 (1)
- 代码检查插件 (1)
- 游戏端开发 (1)
- 微信开发相关 (1)
- 搜索引擎 (1)
- 网络技术 (1)
- 分布式部署 (1)
- 堆栈信息 (1)
最新评论
ZIPFILE
/**
* 下载-将多个文件压缩成zip
*
* @author penz
* @param srcfile 文件列表File
* @param zipfile 文件名的File
*/
public static void zipFiles(java.io.File[] srcfile, java.io.File zipfile) {
byte[] buf = new byte[1024];
try {
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipfile));
for (int i = 0; i < srcfile.length; i++) {
FileInputStream in = new FileInputStream(srcfile[i]);
out.putNextEntry(new ZipEntry(srcfile[i].getName()));
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
} catch (Exception e) {
log.error("ExportController.zipFiles 异常: {}", e);
e.printStackTrace();
}
}
package com.kame.micropay.order.service.utils;
import java.util.ArrayList;
import java.util.List;
/**
* 说明: List相关工具类
*
* @author penz @date 2013-10-18
*/
public class ListUtil {
/**
* 将list分成多个List
*
* @author penz
* @param list 集合对象
* @param pageSize 每个集合大小数
* @return
*/
public static <T> List<List<T>> splitList(List<T> list, int pageSize) {
int listSize = list.size();
int page = (listSize + (pageSize - 1)) / pageSize;
List<List<T>> listArray = new ArrayList<List<T>>();
for (int i = 0; i < page; i++) {
List<T> subList = new ArrayList<T>();
for (int j = 0; j < listSize; j++) {
int pageIndex = ((j + 1) + (pageSize - 1)) / pageSize;
if (pageIndex == (i + 1)) {
subList.add(list.get(j));
}
if ((j + 1) == ((i + 1) * pageSize)) {
break;
}
}
listArray.add(subList);
}
return listArray;
}
}
/**
* 输出报表
* @param response
* @param data
*/
public static void reportExp(HttpServletResponse response, String templateUrl, Map<String, Object> data) {
OutputStream fOut = null;
InputStream fin = null;
try {
URL url = new URL(templateUrl);
URLConnection connection = url.openConnection();
fin = connection.getInputStream();
fOut = response.getOutputStream();
XLSTransformer transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
log.error("报表导出异常", e);
} finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("报表导出异常", ie);
}
}
}
/**
* 下载
*
* @author penz
* @param bais ByteArrayInputStream对象
* @param fileName 文件名
* @param response HttpServletResponse对象
*/
public static void download(InputStream bais, String fileName, HttpServletResponse response) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
response.setCharacterEncoding("UTF-8");
OutputStream out = response.getOutputStream();
response.setContentType("application/x-download");
response.addHeader("Content-disposition", "attachment;filename="
+ new String(fileName.getBytes(), "ISO-8859-1"));
response.setHeader("Content-disposition", "attachment;filename="
+ new String(fileName.getBytes(), "ISO-8859-1"));
bis = new BufferedInputStream(bais);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
log.error("ExportController.download 异常: {}", e);
} finally {
try {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
* 下载-将多个文件压缩成zip
*
* @author penz
* @param srcfile 文件列表File
* @param zipfile 文件名的File
*/
public static void zipFiles(java.io.File[] srcfile, java.io.File zipfile) {
byte[] buf = new byte[1024];
try {
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipfile));
for (int i = 0; i < srcfile.length; i++) {
FileInputStream in = new FileInputStream(srcfile[i]);
out.putNextEntry(new ZipEntry(srcfile[i].getName()));
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
} catch (Exception e) {
log.error("ExportController.zipFiles 异常: {}", e);
e.printStackTrace();
}
}
package com.kame.micropay.order.service.utils;
import java.util.ArrayList;
import java.util.List;
/**
* 说明: List相关工具类
*
* @author penz @date 2013-10-18
*/
public class ListUtil {
/**
* 将list分成多个List
*
* @author penz
* @param list 集合对象
* @param pageSize 每个集合大小数
* @return
*/
public static <T> List<List<T>> splitList(List<T> list, int pageSize) {
int listSize = list.size();
int page = (listSize + (pageSize - 1)) / pageSize;
List<List<T>> listArray = new ArrayList<List<T>>();
for (int i = 0; i < page; i++) {
List<T> subList = new ArrayList<T>();
for (int j = 0; j < listSize; j++) {
int pageIndex = ((j + 1) + (pageSize - 1)) / pageSize;
if (pageIndex == (i + 1)) {
subList.add(list.get(j));
}
if ((j + 1) == ((i + 1) * pageSize)) {
break;
}
}
listArray.add(subList);
}
return listArray;
}
}
/**
* 输出报表
* @param response
* @param data
*/
public static void reportExp(HttpServletResponse response, String templateUrl, Map<String, Object> data) {
OutputStream fOut = null;
InputStream fin = null;
try {
URL url = new URL(templateUrl);
URLConnection connection = url.openConnection();
fin = connection.getInputStream();
fOut = response.getOutputStream();
XLSTransformer transformer = new XLSTransformer();
Workbook workbook = transformer.transformXLS(fin, data);
workbook.write(fOut);
} catch (Exception e) {
log.error("报表导出异常", e);
} finally {
try {
if (fOut != null) {
fOut.flush();
fOut.close();
}
if (fin != null) {
fin.close();
}
} catch (IOException ie) {
log.error("报表导出异常", ie);
}
}
}
/**
* 下载
*
* @author penz
* @param bais ByteArrayInputStream对象
* @param fileName 文件名
* @param response HttpServletResponse对象
*/
public static void download(InputStream bais, String fileName, HttpServletResponse response) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
response.setCharacterEncoding("UTF-8");
OutputStream out = response.getOutputStream();
response.setContentType("application/x-download");
response.addHeader("Content-disposition", "attachment;filename="
+ new String(fileName.getBytes(), "ISO-8859-1"));
response.setHeader("Content-disposition", "attachment;filename="
+ new String(fileName.getBytes(), "ISO-8859-1"));
bis = new BufferedInputStream(bais);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
log.error("ExportController.download 异常: {}", e);
} finally {
try {
if (bis != null)
bis.close();
if (bos != null)
bos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
相关推荐
Python库`zipfile2-0.0.10-py2.py3-none-any.whl`是一个专门为Python开发的模块,用于处理和操作ZIP文件格式。这个库是Python 2和Python 3兼容的,这意味着无论你使用的是哪个版本的Python,你都可以无缝地安装和...
`ZipFile`类库是.NET Framework提供的一种强大的工具,专门用于处理ZIP格式的压缩文件。本篇文章将深入探讨如何使用`ZipFile`库来实现目录的压缩和解压缩功能,以及如何支持二级解压。 首先,`ZipFile`类位于`...
SrcFile,ZipFile:pchar):integer;stdcall; 功能 : 将文件SrcFile添加到压缩文档ZipFile 参数 : SrcFile 待压缩文件(全路径) Zipfile 目标文件(全路径) 返回 : 失败 >0 成功 说明 : 同名文件将自动...
将该文件改名后(myzipfile.py)和程序放在一起,导入时可以使用as改名来兼容旧代码(import myzipfile as zipfile) 二:替换原版zipfile模块(不推荐,程序可能会无法移植) 放在python路径下的Lib文件夹里 由于...
资源分类:Python库 所属语言:Python 资源全名:zipfile39-0.0.4.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Apache Commons Compress库提供了强大的工具,其中就包括`ZipFile`类,它在处理ZIP文件时能有效地解决中文字符编码问题,确保文件解压后中文内容的正确显示。这个`ZipFile`类在`ant.jar`包中,它是Apache Ant项目的...
net.lingala.zip4j.core.ZipFile_1.3.2.jar 解压缩zip,带解压进度
资源分类:Python库 所属语言:Python 资源全名:zipfile-deflate64-0.2.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源来自pypi官网。 资源全名:zipfile2-0.0.10-py2.py3-none-any.whl
ZipFile.dll 压缩解压第三方类库
这是完整的将.net4.5中ZipFile功能摘出来,通过修改命名空间后可以完美应用于.net3.5/4.0上(3.0就不再做了,牵扯的太多)。 因为早期版本缺失解压缩功能(Package不支持中文),作为一个C#爱好者,仅仅是为了弥补这...
这是从.net4.5里摘出来的ZipFile功能,可以应用到.net4.0的平台上,用法和4.5里一样。 以后会考虑将.net的版本降至3.5甚至2.0,这需要看里面都用到了什么功能(保守估计3.5应该没问题)
标题中的"sample (2)_zipfile_源码"暗示了我们将讨论的是与处理ZIP文件相关的编程源代码。ZIP文件是一种常见的文件压缩格式,用于存储多个文件和目录在单个档案中,广泛应用于软件分发、数据备份等领域。Python的`...
Python的`zipfile`模块是处理ZIP档案文件的核心工具,它提供了创建、读取、写入和提取ZIP文件的能力。ZIP是一种常见的文件压缩格式,广泛用于数据归档和分发。下面将详细讲解`zipfile`模块的一些关键功能和用法。 1...
Python编程语言中,shutil和zipfile是两个非常实用的内置模块,它们分别用于高级文件操作和处理zip压缩文件。本文将详细介绍这两个模块的主要功能和简单应用。 shutil模块是Python标准库的一部分,它扩展了os模块的...
zip4j默认采用UTF-8编码,所以它支持中文,同时也支持密码,而且支持多种压缩算法,可以说功能强大,但使用起来却非常简单,当然,如果需求比较复杂,那就得好好去研究了。如果你仅仅是简单地解压一个zip压缩文件,...
《camel-zipfile-2.17.3.zip与aiw-i2b2-etl开源项目解析》 在IT行业中,开源项目扮演着至关重要的角色,它们为开发者提供了丰富的资源和工具,推动了技术创新和协作。本文将深入探讨标题中的"camel-zipfile-2.17.3....
《DAVE-3-1-10_ZipFile-2014-05-23.zip:英飞凌嵌入式电机开发的历史回顾与技术探析》 在电子技术领域,英飞凌科技(Infineon Technologies)一直以其卓越的半导体解决方案闻名,尤其在嵌入式系统和电机控制方面...
PHPZip类,生成zip格式的压缩包,生成压缩并下载,简单的zip压缩类
Python的`zipfile`模块是处理ZIP压缩文件的核心工具,提供了对ZIP文件的读、写和提取功能。本文将深入探讨`zipfile`模块的工作原理和常见使用方法,以帮助开发者更好地理解和应用这一功能。 首先,`zipfile`模块...