Created
May 2, 2016 09:42
-
-
Save d4rken/aa1b65c480e16782adbf2a2c7ea2fda8 to your computer and use it in GitHub Desktop.
Unpack a file from assets.
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
Timber.tag(TAG).i("Copying new binary..."); | |
AssetManager assets = getContext().getAssets(); | |
InputStream in = assets.open(assetName); | |
FileOutputStream f; | |
f = getContext().openFileOutput(mBinaryConfig.getBaseBinaryName(), Context.MODE_PRIVATE); | |
byte[] buffer = new byte[1024]; | |
int len1; | |
while ((len1 = in.read(buffer)) > 0) { | |
f.write(buffer, 0, len1); | |
} | |
f.close(); | |
Timber.tag(TAG).i("binary has been successfully created."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment