Revision 8106
trunk/libraries/libIverUtiles/src/com/iver/utiles/FileUtils.java | ||
---|---|---|
41 | 41 |
package com.iver.utiles; |
42 | 42 |
|
43 | 43 |
import java.io.File; |
44 |
import java.io.FileInputStream; |
|
45 |
import java.io.FileOutputStream; |
|
46 |
import java.io.IOException; |
|
47 |
import java.io.InputStream; |
|
48 |
import java.io.OutputStream; |
|
44 | 49 |
|
45 | 50 |
|
46 | 51 |
/** |
... | ... | |
74 | 79 |
return fileName; |
75 | 80 |
} |
76 | 81 |
|
82 |
void copy(File src, File dst) throws IOException { |
|
83 |
InputStream in = new FileInputStream(src); |
|
84 |
OutputStream out = new FileOutputStream(dst); |
|
85 |
|
|
86 |
// Transfer bytes from in to out |
|
87 |
byte[] buf = new byte[10240]; |
|
88 |
int len; |
|
89 |
while ((len = in.read(buf)) > 0) { |
|
90 |
out.write(buf, 0, len); |
|
91 |
} |
|
92 |
in.close(); |
|
93 |
out.close(); |
|
94 |
} |
|
77 | 95 |
|
78 | 96 |
} |
Also available in: Unified diff