Commit 2b12bfe8 authored by Kishen Maloor's avatar Kishen Maloor

Fix impl of IORepository::getBytesFromFile()

Signed-off-by: Kishen Maloor's avatarKishen Maloor <kishen.maloor@intel.com>
parent d126a828
...@@ -168,8 +168,10 @@ public class IORepository { ...@@ -168,8 +168,10 @@ public class IORepository {
byte[] fileBytes; byte[] fileBytes;
try (InputStream inputStream = try (InputStream inputStream =
mContext.getAssets().open(path)) { mContext.getAssets().open(path)) {
fileBytes = new byte[inputStream.available()]; int numBytes = inputStream.available() + 1;
fileBytes = new byte[numBytes];
inputStream.read(fileBytes); inputStream.read(fileBytes);
fileBytes[numBytes - 1] = '\0';
} }
return fileBytes; return fileBytes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment