会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
txw100
淘包岛
同行网,同行你我他
不要去想前面的路有多么的遥远,艰难,或者有没有路,坚持一直走下去吧。
博客园
首页
新随笔
联系
订阅
管理
生成XML文件然后打包成zip文件后存到硬盘中
/**/
/*
* NewClass.java
*
* Created on 2008年2月17日, 下午10:51
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package
javaapplication2;
import
java.util.zip.ZipOutputStream;
import
java.util.zip.
*
;
import
java.io.FileOutputStream;
import
java.util.
*
;
import
java.io.DataOutputStream;
/** */
/**
*
*
@author
Administrator
*/
public
class
NewClass
{
/** */
/**
Creates a new instance of NewClass
*/
public
NewClass()
{
}
public
static
void
main(String[] arg)
throws
Exception
{
String xml;
/**/
/*
* 生成你的xml数据,存在String xml中。
*/
ZipOutputStream zipOut
=
new
ZipOutputStream(
new
FileOutputStream(
"
D://test.zip
"
));
//
声明ZipOutputStream,用来输出zip文件。
ZipEntry entry
=
new
ZipEntry(
"
test.xml
"
);
//
声明ZipEntry
zipOut.putNextEntry(entry);
//
将entry加入到zipOut中。
DataOutputStream dataOs
=
new
DataOutputStream(zipOut);
//
利用DataOutputStream对ZipOutputStream进行包装。
dataOs.writeUTF(
""
);
//
输出zip文件。
dataOs.close();
}
}
posted @
2008-02-17 23:19
wj-conquer
阅读(
560
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告