code: public void downloadFile(int fileId, java.io.File target, FileSize size)
  			throws IOException {
  		WebResource builder = getResourceFactory()
  				.getFileResource("/" + fileId);
  		if (size != null) {
  			builder = builder.path("/" + size.name().toLowerCase());
  		}
  		byte[] data = builder.get(byte[].class);
  		FileUtils.writeByteArrayToFile(target, data);
  	}
docs: Downloads the file and saves it to given file
  
  @param fileId
  The id of the file to download
  @param target
  The target file to save the contents to
  @throws IOException
  If there was an error reading or writing the file