I could not find a good way to check if the file exists before downloading it. It seems the API doesnt provide a way to check if the file exists by getting the file by ID.
Basically Im checking if the generated outPutStream size is > 0 to process the file, but I didnt like the solution.
Drive driveService = new Drive.Builder(buildHttpTransport(), JSON_FACTORY, googleCredential).build();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
driveService.files().get(this.fileId).executeMediaAndDownloadTo(outputStream);
if(outputStream.size() == 0)
processFile()
Ideas are welcome!