Created
April 19, 2018 11:08
-
-
Save hsmnzaydn/2284728212acfad16431fde669a1d0c4 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 MappedByteBuffer loadModelFile(Activity activity, String MODEL_FILE) throws IOException { | |
AssetFileDescriptor fileDescriptor = activity.getAssets().openFd(MODEL_FILE); | |
FileInputStream inputStream = new FileInputStream(fileDescriptor.getFileDescriptor()); | |
FileChannel fileChannel = inputStream.getChannel(); | |
long startOffset = fileDescriptor.getStartOffset(); | |
long declaredLength = fileDescriptor.getDeclaredLength(); | |
return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment