随便写了一下,没测试:
public String ReadFile(String filename)throw IOException
{
String buffer=new String();
byte data[]=new byte[500];
int byteread;
try
{
FileInputStream inputfile=new FileInputStream(filename);
DataInputStream inputdata=new DataInputStream(inputfile);
while((byteread=inputdata.read(data))!=-1)
{
buffer=buffer+new String(data,0,byteread);
}
inputdata.close();
}
catch(IOException e)
{
throw e;
}
return(buffer);
}
public String ReadFile(String filename)throw IOException
{
String buffer=new String();
byte data[]=new byte[500];
int byteread;
try
{
FileInputStream inputfile=new FileInputStream(filename);
DataInputStream inputdata=new DataInputStream(inputfile);
while((byteread=inputdata.read(data))!=-1)
{
buffer=buffer+new String(data,0,byteread);
}
inputdata.close();
}
catch(IOException e)
{
throw e;
}
return(buffer);
}
等待高手,学习