Download pdf file in google docs using java?

I am trying to upload a PDF file to Google Docs / Drive, I use the following code for this ...

int MAX_CONCURRENT_UPLOADS = 10; int PROGRESS_UPDATE_INTERVAL = 1000; int DEFAULT_CHUNK_SIZE = 10485760; ExecutorService executor = Executors.newFixedThreadPool(MAX_CONCURRENT_UPLOADS); File file = new File(filePath); String mimeType=DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType(); String contentType=DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType(); MediaFileSource mediaFile = new MediaFileSource(file, contentType); URL createUploadUrl = new URL("https://drive.google.com/feeds/upload/create-session/default/private/full"); FileUploadProgressListener listener = new FileUploadProgressListener(); ResumableGDataFileUploader uploader=new ResumableGDataFileUploader(createUploadUrl,mediaFile,service, DEFAULT_CHUNK_SIZE, executor, listener, PROGRESS_UPDATE_INTERVAL); 

But FileUploadProgressListener shows an error, is it a google api or class ...?

Please help what’s wrong to download the PDF file ....

Thanks in advance

+4
source share

All Articles