convert video files to byte array in android
In my and开发者_C百科roid application i am recording and saving the file in sdcard. Now i would like to convert this saved file to byte array and sent it to the server.
Could anyone please let me know as how can i convert video files to byte array
Please forward your valuable suggestions.
Thanks in advance :)
try this:
String strFile=null;
File file=new File(pathOnSdCard);
try {
byte[] data = FileUtils.readFileToByteArray(file);//Convert any file, image or video into byte array
strFile = Base64.encodeToString(data, Base64.NO_WRAP);//Convert byte array into string
} catch (IOException e) {
e.printStackTrace();
}
return strFile;
}
精彩评论