import java.io.*;
class Test
{
public static void main(String [] args)
{
//读
FileInputStream s=null;
try
{
s=new FileInputStream("路径");
byte [] b=new byte[1024];
while(true)
{
int temp=s.read(b,0,b.length);
if(temp==-1)
{
break;
}
}
//把字节数组转化成字符串
String ss=new String(b);
System.out.println(ss);
}
}
}
import java.io.*;
class Test
{
public static void main(String [] args)
{
//写
FileInputStream s=null;
FileoutputStream w=null;
try
{
s=new FileInputStream("路径");
w=new FileoutputStream("路径");
byte [] b=new byte[1024];
while(true)
{
int temp=s.read(b,0,b.length);
if(temp==-1)
{
break;
}
w.write(b,0,temp);
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
s.close();
w.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}