方大帝的JAVA空間
JAVA
BlogJava
首頁
新隨筆
聯系
聚合
管理
posts - 33, comments - 11, trackbacks - 0
輸入流和輸出流
InputStream:輸入流 InputStream in = new FileInputStream(file1); file1指讀取文件的路徑
OutputStream:輸出流 OutputStream ou = new FileOutputStream(file2); file2指寫入文件的路徑
BufferInputStream高級輸入流 BufferedInputStream bi=new BufferedInputStream(in);
BufferOutputStream高級輸出流 BufferedOutputStream out = new BufferedOutputStream(ou);
File file
=
new
File(
"
d:\\通知.doc
"
);
try
{
long
st
=
System.currentTimeMillis();
InputStream in
=
new
FileInputStream(file);
BufferedInputStream bi
=
new
BufferedInputStream(in);
OutputStream ou
=
new
FileOutputStream(
"
d:\\通知11.doc
"
);
BufferedOutputStream out
=
new
BufferedOutputStream(ou
);
int
b
=
0
;
while
((b
=
bi.read())
!=
-
1
)
{
//
循環讀取in對象的字節
out.write(b);
//
寫入到文件
}
try
{
in.close();
out.flush();
out.close();
//
好習慣
}
catch
(Exception e)
{
e.printStackTrace();
}
long
et
=
System.currentTimeMillis();
System.out.print (et
-
st);
//
System.out.println(s);
}
catch
(IOException e)
{
e.printStackTrace();
}
}
posted on 2011-05-07 17:19
方濤升
閱讀(476)
評論(0)
編輯
收藏
所屬分類:
j2ee
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
MySQL大表重復字段的查詢方法
輸入流和輸出流
MyEclipse5.5注冊機
java將Word/Excel/PDF文件轉換成HTML整理
apche與多個tomcat整合
ssh+taglib實現分頁
用JS在頁面上顯示當前的時間
根據分割符截取字符串
java錯誤大集合
JSP中嵌套IF語句
Copyright ©2025 方濤升 Powered By:
博客園
模板提供:
滬江博客
<
2011年5月
>
日
一
二
三
四
五
六
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆分類
hibernate(3)
j2ee(12)
javascript(2)
jQuery EasyUI(1)
JS(2)
json(1)
lucene(3)
spring(2)
struts(3)
配置
隨筆檔案
2014年12月 (1)
2014年4月 (1)
2012年5月 (1)
2011年12月 (1)
2011年5月 (1)
2011年4月 (2)
2009年7月 (3)
2009年6月 (6)
2008年12月 (1)
2008年4月 (1)
2008年1月 (5)
2007年12月 (10)
文章分類
jQuery EasyUI
搜索
最新評論
1.?re: java將Word/Excel/PDF文件轉換成HTML整理
不管用啊,有沒有源碼給分享下啊~~~
--諾諾
2.?re: java將Word/Excel/PDF文件轉換成HTML整理
Source: Microsoft Excel
Description: 類 Workbook 的 SaveAs 方法無效
請問這個怎么解決
--;;
3.?re: MyEclipse5.5注冊機
hao dong xi
--lxg
4.?re: java將Word/Excel/PDF文件轉換成HTML整理
評論內容較長,點擊標題查看
--529597089
5.?re: html按鈕button怎么加超鏈接
asdf
--sd
閱讀排行榜
1.?java將Word/Excel/PDF文件轉換成HTML整理(14740)
2.?html按鈕button怎么加超鏈接(3198)
3.?struts標簽庫導入(2095)
4.?JSP中嵌套IF語句(1730)
5.?用hibernate search增量索引(1685)
評論排行榜
1.?java將Word/Excel/PDF文件轉換成HTML整理(3)
2.?Spring定時執行(2)
3.?ssh+taglib實現分頁(1)
4.?Layout 布局(1)
5.?JSP中嵌套IF語句(1)
主站蜘蛛池模板:
泰州市
|
陇西县
|
新乐市
|
福清市
|
沧州市
|
桐梓县
|
连山
|
江油市
|
中西区
|
靖江市
|
聊城市
|
安丘市
|
阿坝县
|
潮安县
|
苍梧县
|
广宁县
|
江山市
|
宝清县
|
星座
|
红原县
|
商河县
|
海淀区
|
平安县
|
恩平市
|
和顺县
|
镇远县
|
五原县
|
华池县
|
清新县
|
运城市
|
资中县
|
青海省
|
高淳县
|
雷波县
|
互助
|
福建省
|
即墨市
|
保靖县
|
南宁市
|
布尔津县
|
固阳县
|