[color=violet]
public void readDate(String fileName)
{
try
{
BufferedReader in=new BufferedReader(new FileReader(fileName);
String temp="";
String s=new String();
while((s=in.readLine())!=null)
temp+=s+"\n";
in.close();//关闭输入流
System.out.println(temp);
}
catch(FileNotFoundException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
}
**************************************************************
import java.io.*;
class E{
public static void main(String args[])
{
int b; byte buffer[]=new byte[2500];
try{
FileInputStream readfile=new FileInputStream("E.java");
b=readfile.read(buffer,0,2500);
try{
String str=new String(buffer,0,b,"Default");
System.out.println(str);
}catch(UnsupportedEncodingException e)
{
System.out.println("the encoding was not found:"+e);
}
}catch(IOException e)
{
System.out.println("File read Error !");
}
}
}[/color]
public void readDate(String fileName)
{
try
{
BufferedReader in=new BufferedReader(new FileReader(fileName);
String temp="";
String s=new String();
while((s=in.readLine())!=null)
temp+=s+"\n";
in.close();//关闭输入流
System.out.println(temp);
}
catch(FileNotFoundException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
}
**************************************************************
import java.io.*;
class E{
public static void main(String args[])
{
int b; byte buffer[]=new byte[2500];
try{
FileInputStream readfile=new FileInputStream("E.java");
b=readfile.read(buffer,0,2500);
try{
String str=new String(buffer,0,b,"Default");
System.out.println(str);
}catch(UnsupportedEncodingException e)
{
System.out.println("the encoding was not found:"+e);
}
}catch(IOException e)
{
System.out.println("File read Error !");
}
}
}[/color]