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
閱讀(593)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
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中輸入換行、空格等,以正確的格式后臺存儲和前臺顯示
法規和法規和法規和符合人體后對符合人體會讓他的返回任何人的融合和的個人各的人格的若干的負荷的任何
--的發貨的費
3.?re: JPA學習筆記
非常實用
--劉高潮
4.?re: textarea中輸入換行、空格等,以正確的格式后臺存儲和前臺顯示[未登錄]
啊啊啊啊 啊啊啊啊
啊啊啊啊
--1
5.?re: JPA學習筆記
評論內容較長,點擊標題查看
--zuidaima
閱讀排行榜
1.?JPA學習筆記(20246)
2.?jQuery MiniUI學習(轉載)(11722)
3.?獲取八位UUID標識碼(3383)
4.?將私有的jar包導入到maven本地庫(1607)
5.?從url獲取圖片(1433)
評論排行榜
1.?JPA學習筆記(3)
2.?從url獲取圖片(0)
3.?webservice axis2學習(轉載地址)(0)
4.?jQuery MiniUI學習(轉載)(0)
5.?jquery ajax范例(0)
主站蜘蛛池模板:
腾冲县
|
安丘市
|
香港
|
大方县
|
合肥市
|
新和县
|
长汀县
|
射洪县
|
四川省
|
马龙县
|
晴隆县
|
千阳县
|
留坝县
|
纳雍县
|
洪雅县
|
连平县
|
西充县
|
莒南县
|
余姚市
|
宁城县
|
克东县
|
富蕴县
|
文山县
|
龙口市
|
连南
|
栾川县
|
车险
|
许昌市
|
云林县
|
吉安市
|
和田县
|
太和县
|
紫阳县
|
长治市
|
伊川县
|
汝城县
|
西宁市
|
阿坝
|
久治县
|
长武县
|
永平县
|