reportFile.setParents(Arrays.asList(new ParentReference().setId(outputFolder.getId())));
// Write the PDF file to Drive.
if (reportFileType.equals(ReportFileType.PDF)) {
reportFile.setMimeType(PDF_MIME_TYPE);
AbstractInputStreamContent aisc = new InputStreamContent(PDF_MIME_TYPE, inputStream);
googleDriveService.getDriveService().files().insert(reportFile, aisc).execute();
}
// Write the HTML file to Drive.
if (reportFileType.equals(ReportFileType.HTML)) {
reportFile.setMimeType(HTML_MIME_TYPE);
AbstractInputStreamContent aisc = new InputStreamContent(HTML_MIME_TYPE, inputStream);
googleDriveService.getDriveService().files().insert(reportFile, aisc).execute();
}
// Convert the HTML file to a Drive Doc and write to Drive.
if (reportFileType.equals(ReportFileType.DRIVE_DOC)) {
reportFile.setMimeType(DOC_MIME_TYPE);
AbstractInputStreamContent aisc = new InputStreamContent(HTML_MIME_TYPE, inputStream);
googleDriveService.getDriveService().files().insert(reportFile, aisc).setConvert(true).execute();
}
inputStream.close();
}