DataInputStream fdi=new DataInputStream(new FileInputStream(file));
通过这个方式来读css文件,while((temp_line=fdi.readLine())!=null){}
里面的汉字乱码了..这是为什么..css文件是以gbk方式编码的.
通过这个方式来读css文件,while((temp_line=fdi.readLine())!=null){}
里面的汉字乱码了..这是为什么..css文件是以gbk方式编码的.
我不懂,问问。
String str;
while((str=br.readLine())!=null){
System.out.println(str);
}
不要用DataInputStream来readLine,看下面
-----------------------------------------------------------------
readLine
@Deprecated
public final String readLine()
throws IOExceptionDeprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form:
DataInputStream d = new DataInputStream(in);
with:
BufferedReader d
= new BufferedReader(new InputStreamReader(in));