Created
December 28, 2009 15:38
-
-
Save itog/264733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void combineDevidedFiles(String destination, String devidedFilePrefix) { | |
File destFile = new File(destination); | |
destFile.mkdirs(); | |
destination += devidedFilePrefix; | |
destFile = new File(destination); | |
InputStream input = null; | |
try { | |
AssetManager assetManager = context.getAssets(); | |
OutputStream output = new FileOutputStream(destFile); | |
for (int i=1;i<=FILE_DIVIDED_NUM;i++) { | |
input = assetManager.open(DEVIDED_FILE_PREFIX + String.valueOf(i), AssetManager.ACCESS_STREAMING); | |
byte[] buf = new byte[DEFAULT_BUFFER_SIZE]; | |
int size; | |
while (true) { | |
size = input.read(buf); | |
if (size <= 0) { | |
break; | |
} | |
output.write(buf, 0, size); | |
} | |
input.close(); | |
} | |
output.close(); | |
} catch (Exception e) { | |
destFile.delete(); | |
Log.w(TAG, e.getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment