Did you include the media jar?

On Mon, Jul 13, 2009 at 9:00 AM, Peter <naveen.ven...@gmail.com> wrote:

>
> Hi guys,
>
> I ran into a problem when I try to export document using GData API's.
>
> I'm using the following Java code to read the contents of the document
> as a stream.
>
> [quote]
>
>        String docType = resourceId.substring(0, resourceId.lastIndexOf
> (':'));
>        String docId = resourceId.substring(resourceId.lastIndexOf
> (':') + 1);
>
>        URL exportUrl = new URL("http://docs.google.com/feeds/
> download/" + docType + "s/Export?docID=" + docId + "&exportFormat=" +
> format);
>
>        System.out.println("Exporting document from: " + exportUrl);
>
>        MediaContent mc = new MediaContent();
>        mc.setUri(exportUrl.toString());
>        MediaSource ms = service.getMedia(mc);
>
>        InputStream inStream = null;
>        FileOutputStream outStream = null;
>
>        try {
>            inStream = ms.getInputStream();
>            outStream = new FileOutputStream(filepath);
>
>            int c;
>            while ((c = inStream.read()) != -1) {
>                outStream.write(c);
>            }
>        } finally {
>            if (inStream != null) {
>                inStream.close();
>            }
>            if (outStream != null) {
>                outStream.flush();
>                outStream.close();
>            }
>        }
>
> [/quote]
>
> When I compile it says
>
> init:
> deps-jar:
> Compiling 1 source file to /home/naveenv/vosrc/connects/zohoconnects/
> ZohoConnects/build/classes
> /home/naveenv/contactnaveen/GetGoogleDocs.java:80: cannot find symbol
> symbol  : method setUri(java.lang.String)
> location: class com.google.gdata.data.media.mediarss.MediaContent
>        mc.setUri(exportUrl.toString());
> /home/naveenv/contactnaveen/GetGoogleDocs.java:81: cannot find symbol
> symbol  : method getMedia
> (com.google.gdata.data.media.mediarss.MediaContent)
> location: class com.google.gdata.client.docs.DocsService
>        MediaSource ms = service.getMedia(mc);
> 2 errors
> BUILD FAILED (total time: 0 seconds)
>
>
> I'm using  gdata-samples.java-1.34.0.zip from the following the URL
>
> http://gdata-java-client.googlecode.com/files/gdata-samples.java-1.34.0.zip
>
> Are the methods removed in the latest zip file? Is there any other way
> to retrieve the content of the document?
> Any pointers would be quite helpful.
>
> TIA
>
> Naveen. V
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to