public
static
void
copy(String from, String to)
throws
IOException {
int
BUFF_SIZE = 100000;
byte
[] buffer =
new
byte
[BUFF_SIZE];InputStream in =
null
;OutputStream out =
null
;
try
{in =
new
FileInputStream(from);out =
new
FileOutputStream(to);
while
(
true
) {
synchronized
(buffer) {
int
amountRead = in.read(buffer);
if
(amountRead == -1) {
break
;}
out.write(buffer, 0, amountRead);
}
}
}
finally
{
if
(in !=
null
) {in.close();
}
if
(out !=
null
) {out.close();
}
}
}