How to update the content of a file in Google Drive?
<p>I am trying to update the content of a Google Doc file with the content of another Google Doc file. The reason I don't use the <code>copy</code> method of the API is because that creates another file with another ID. My goal is to keep the current ID of the file. This is a code snippet which unfortunately does nothing:</p>

<pre><code>com.google.api.services.drive.Drive.Files.Get getDraft = service.files().get(draftID);
File draft = driveManager.getFileBackoffExponential(getDraft);
com.google.api.services.drive.Drive.Files.Update updatePublished = service.files().update(publishedID, draft);
driveManager.updateFileBackoffExponential(updatePublished);
</code></pre>

<p>The two backoffExponential functions just launch the <code>execute</code> method on the object.</p>

<p>Googling around I found out that the <code>update</code> method offers another constructor:</p>

<pre><code>public Update update(java.lang.String fileId, com.google.api.services.drive.model.File content, com.google.api.client.http.AbstractInputStreamContent mediaContent)
</code></pre>

<p>Thing is, I have no idea how to retrieve the mediaContent of a Google file such as a Google Doc.</p>

<p>The last resort could be a Google Apps Script but I'd rather avoid that since it's awfully slow and unreliable.</p>

<p>Thank you.</p>

<p>EDIT: I am using Drive API v3.</p>