title: How to convert the Video file to byte array?
body: <p>I need to convert a video file to byte array and then send the byte array to a server, but when I upload the byte array the server did not receive it in the correct format. I convert the file like below:-  </p>
  
  <pre class="lang-java prettyprint-override"><code>buffer=new byte[1024];
  os=new ByteArrayOutputStream();
  FileInputStream fis=new FileInputStream(file);
  int read;
  while ((read=fis.read(buffer))!=-1){
      os.write(buffer,0,read);
  }
  fis.close();
  os.close();
  </code></pre>