import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class test {
public static void main(String[] args) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("L:/a/b.txt");
out = new FileOutputStream("h:\\write.txt");
byte[] b = new byte[512];
<span style="white-space:pre"> </span>int length;
<span style="white-space:pre"> </span>while((length=in.read(b))!=-1)
<span style="white-space:pre"> </span>System.out.println(new String(b,0,length));
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
try {
out.close();
} catch (IOException out) {
System.out.println(out.getMessage());
}
try {
in.close();
} catch (IOException in) {
System.out.println(in.getMessage());
}
}
}
}