Revision a09587c7 F-Droid/src/org/fdroid/fdroid/Utils.java
F-Droid/src/org/fdroid/fdroid/Utils.java | ||
---|---|---|
48 | 48 |
import java.io.BufferedInputStream; |
49 | 49 |
import java.io.Closeable; |
50 | 50 |
import java.io.File; |
51 |
import java.io.FileDescriptor; |
|
51 | 52 |
import java.io.FileInputStream; |
52 | 53 |
import java.io.FileOutputStream; |
53 | 54 |
import java.io.IOException; |
... | ... | |
162 | 163 |
} |
163 | 164 |
|
164 | 165 |
public static boolean copy(File inFile, File outFile) { |
166 |
InputStream input = null; |
|
167 |
OutputStream output = null; |
|
165 | 168 |
try { |
166 |
InputStream input = new FileInputStream(inFile);
|
|
167 |
OutputStream output = new FileOutputStream(outFile);
|
|
169 |
input = new FileInputStream(inFile);
|
|
170 |
output = new FileOutputStream(outFile); |
|
168 | 171 |
Utils.copy(input, output); |
169 |
output.close(); |
|
170 |
input.close(); |
|
171 | 172 |
return true; |
172 | 173 |
} catch (IOException e) { |
173 | 174 |
Log.e(TAG, "I/O error when copying a file", e); |
174 | 175 |
return false; |
176 |
} finally { |
|
177 |
closeQuietly(output); |
|
178 |
closeQuietly(input); |
|
175 | 179 |
} |
176 | 180 |
} |
177 | 181 |
|
Also available in: Unified diff