Java天地
IO流將UTF-8文件轉成GBK格式
private
static
void
doReadWriteTextFile(String inputFileName, String outputFileName)
{
try
{
int
bytesRead
=
0
;
FileInputStream fis
=
new
FileInputStream(inputFileName);
InputStreamReader isr
=
new
InputStreamReader(fis,
"
UTF-8
"
);
OutputStreamWriter outputStream
=
new
OutputStreamWriter(
new
FileOutputStream(outputFileName),
"
GBK
"
);
while
((bytesRead
=
isr.read())
!=
-
1
)
{
outputStream.write((
char
) bytesRead);
}
isr.close();
outputStream.close();
System.out.println(
"
ok
"
);
}
catch
(IOException e)
{
System.out.println(
"
IOException:
"
);
e.printStackTrace();
}
}
posted on 2013-04-19 11:49
Mr.lu
閱讀(591)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © Mr.lu
<
2013年4月
>
日
一
二
三
四
五
六
31
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
1
2
3
4
5
6
7
8
9
10
11
導航
BlogJava
首頁
新隨筆
聯系
聚合
管理
統計
隨筆 - 29
文章 - 25
評論 - 26
引用 - 0
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2016年1月 (1)
2015年12月 (2)
2015年4月 (1)
2015年3月 (1)
2014年12月 (1)
2013年12月 (1)
2013年8月 (7)
2013年5月 (1)
2013年4月 (4)
2013年3月 (4)
2012年11月 (1)
2012年10月 (4)
2012年9月 (1)
文章檔案
2016年2月 (1)
2014年12月 (1)
2014年5月 (1)
2014年4月 (1)
2013年4月 (1)
2013年3月 (1)
2012年9月 (5)
2012年6月 (1)
2011年6月 (2)
2011年4月 (5)
2011年3月 (6)
搜索
最新評論
1.?re: textarea中輸入換行、空格等,以正確的格式后臺存儲和前臺顯示
我了
個去
什么
--淡淡的
2.?re: textarea中輸入換行、空格等,以正確的格式后臺存儲和前臺顯示
法規(guī)和法規(guī)和法規(guī)和符合人體后對符合人體會讓他的返回任何人的融合和的個人各的人格的若干的負荷的任何
--的發(fā)貨的費
3.?re: JPA學習筆記
非常實用
--劉高潮
4.?re: textarea中輸入換行、空格等,以正確的格式后臺存儲和前臺顯示[未登錄]
啊啊啊啊 啊啊啊啊
啊啊啊啊
--1
5.?re: JPA學習筆記
評論內容較長,點擊標題查看
--zuidaima
閱讀排行榜
1.?JPA學習筆記(20244)
2.?jQuery MiniUI學習(轉載)(11720)
3.?獲取八位UUID標識碼(3380)
4.?將私有的jar包導入到maven本地庫(1604)
5.?從url獲取圖片(1430)
評論排行榜
1.?JPA學習筆記(3)
2.?從url獲取圖片(0)
3.?webservice axis2學習(轉載地址)(0)
4.?jQuery MiniUI學習(轉載)(0)
5.?jquery ajax范例(0)
主站蜘蛛池模板:
洞口县
|
新野县
|
清河县
|
富锦市
|
司法
|
永昌县
|
藁城市
|
灵山县
|
道孚县
|
陇西县
|
尼木县
|
桑植县
|
东丰县
|
大化
|
元谋县
|
修水县
|
布尔津县
|
苍溪县
|
鸡泽县
|
左贡县
|
金乡县
|
洮南市
|
洞口县
|
沛县
|
德格县
|
绥中县
|
诸城市
|
噶尔县
|
泽州县
|
禹城市
|
平安县
|
屯留县
|
阿拉善盟
|
来宾市
|
会同县
|
于都县
|
祁东县
|
天台县
|
前郭尔
|
陕西省
|
盈江县
|