当前位置: 技术问答>java相关
急救...........(文件读写出现乱码)在线....
来源: 互联网 发布时间:2015-05-11
本文导语: 我在读写一个日文文件时,写进的文件都是乱码 这个小程序的主要目的就是去掉空行 请大家帮帮忙 谢谢。 import java.io.*; public class Atrim { public Atrim() { } public static void main(String[] args) { PrintWriter out...
我在读写一个日文文件时,写进的文件都是乱码
这个小程序的主要目的就是去掉空行
请大家帮帮忙
谢谢。
import java.io.*;
public class Atrim {
public Atrim() {
}
public static void main(String[] args) {
PrintWriter out = null;
BufferedReader in = null;
String sLine="";
try{
in = new BufferedReader( new FileReader( new File("referance1.txt") ));
out = new PrintWriter( new FileWriter(new File("reference.txt")));
}catch(Exception ioe){
System.out.println("File ERR");
return;
}
try{
String s;
while ((sLine = in.readLine()) != null){
if(!sLine.trim().equals("")){
out.println(sLine);
}
}
in.close();
out.close();
}catch(Exception e){
System.out.println("File write ERR");
return;
}
}
}
这个小程序的主要目的就是去掉空行
请大家帮帮忙
谢谢。
import java.io.*;
public class Atrim {
public Atrim() {
}
public static void main(String[] args) {
PrintWriter out = null;
BufferedReader in = null;
String sLine="";
try{
in = new BufferedReader( new FileReader( new File("referance1.txt") ));
out = new PrintWriter( new FileWriter(new File("reference.txt")));
}catch(Exception ioe){
System.out.println("File ERR");
return;
}
try{
String s;
while ((sLine = in.readLine()) != null){
if(!sLine.trim().equals("")){
out.println(sLine);
}
}
in.close();
out.close();
}catch(Exception e){
System.out.println("File write ERR");
return;
}
}
}
|
你的程序没问题:
我在我计算机上运行没问题!
你看我的动动:
referance1.txt
***********************************************************************
Fatal NI connect error 12560, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracleORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(CONNECT_DATA=(SID=ORCL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 11:57:29
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12560
TNS-12560: TNS:协议适配器出现错误
ns secondary err code: 0
nt main err code: 530
TNS-00530: 协议适配器错误
nt secondary err code: 126
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:21
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:25
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:30
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 15:04:46
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
我在我计算机上运行没问题!
你看我的动动:
referance1.txt
***********************************************************************
Fatal NI connect error 12560, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=BEQ)(PROGRAM=oracle)(ARGV0=oracleORCL)(ARGS='(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))'))(CONNECT_DATA=(SID=ORCL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 11:57:29
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12560
TNS-12560: TNS:协议适配器出现错误
ns secondary err code: 0
nt main err code: 530
TNS-00530: 协议适配器错误
nt secondary err code: 126
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:21
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:25
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 14:41:30
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0
***********************************************************************
Fatal NI connect error 12541, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=202.117.14.26)(PORT=1521))(CONNECT_DATA=(SID=ORAL)(CID=(PROGRAM=C:Documents and SettingsAdministrator桌面EZSQL.EXE)(HOST=LUOSHIFEI)(USER=Administrator))))
VERSION INFORMATION:
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 8.1.7.0.0 - Production
Time: 17-4月 -2002 15:04:46
Tracing not turned on.
Tns error struct:
nr err code: 0
ns main err code: 12541
TNS-12541: TNS:无监听器
ns secondary err code: 12560
nt main err code: 511
TNS-00511: 无监听器
nt secondary err code: 61
nt OS err code: 0