title: Define a filebody when provided with bytestream of a file's content
body: <p>I am trying to use apache http client v4.x.</p>
  
  <p>For a specific case, I have to make a multipart form request...</p>
  
  <p>A multi part form request is made in java using following code--</p>
  
  <pre><code>HttpPost httppost = new HttpPost("http://localhost:8080" + "/servlets-examples/servlet/RequestInfoExample");
  
  FileBody bin = new FileBody(new File(args[0]));
  MultipartEntity reqEntity = new MultipartEntity();
  reqEntity.addPart("bin", bin);
  httppost.setEntity(reqEntity);
  HttpResponse response = httpclient.execute(httppost);
  </code></pre>
  
  <p>In my case, I have the byte stream of a file body available with me,</p>
  
  <pre><code>byte[] bytes = value.toBinary(charset);
  </code></pre>
  
  <p>Now I want to add this file (byte stream) to the multipart entity, so that I can make a multipart post request... how do I do this?</p>