Code example for FileEntity

0
		this.entity = new StringEntity(object);
		this.entity.setContentType("application/json");		
	} 
 
	public void setRequestBody(File object, String contentType){
		this.entity = new FileEntity(object, contentType);
	} 
 
	private String StreamToString(InputStream in){
		BufferedReader br
		= new BufferedReader(
				new InputStreamReader(in));
 
		StringBuilder sb = new StringBuilder();
 
		String line;
		try { 
			while ((line = br.readLine()) != null) {
				sb.append(line);
			} 
Connect your IDE to all the code out there  Get Codota for Java