Package com.google.gdata.data.media

Examples of com.google.gdata.data.media.MediaSource


        ServiceException {
      System.out.println("Downloading file from: " + downloadUrl);

      MediaContent mc = new MediaContent();
      mc.setUri(downloadUrl);
      MediaSource ms = service.getMedia(mc);

      InputStream inStream = null;
      FileOutputStream outStream = null;

      try {
        inStream = ms.getInputStream();
        outStream = new FileOutputStream(fullFilePath);

        int c;
        while ((c = inStream.read()) != -1) {
          outStream.write(c);
View Full Code Here


    System.out.print("Downloading document with id :" + id + " ....");
    System.out.flush();

    MediaContent mc = new MediaContent();
    mc.setUri(feedUrl.toString());
    MediaSource ms = service.getMedia(mc);

    InputStream inStream = null;
    FileOutputStream outStream = null;
    try {
      inStream = ms.getInputStream();
      outStream = new FileOutputStream(targetFile);

      int c;
      while ((c = inStream.read()) != -1) {
        outStream.write(c);
View Full Code Here

  public InputStream getPdfInputStream(DocumentListEntry document) throws ServiceException {
    String exportUrl = ((MediaContent)document.getContent()).getUri() + "&exportFormat=pdf";
    MediaContent mc = new MediaContent();
    mc.setUri(exportUrl);
    try {
      MediaSource ms = client().getMedia(mc);
      return ms.getInputStream();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

      throw new DocumentListException("null passed in for required parameters");
    }

    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);
View Full Code Here

TOP

Related Classes of com.google.gdata.data.media.MediaSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.