Package com.google.api.client.http

Examples of com.google.api.client.http.FileContent


    public static com.google.api.services.drive.model.File genericFileToGoogleDriveFile(GenericFile<?> file, Exchange exchange) throws Exception {      
        if (file.getFile() instanceof File) {
            File f = (File) file.getFile();
            com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
            fileMetadata.setTitle(f.getName());
            FileContent mediaContent = new FileContent(null, f);
            if (exchange != null) {
                exchange.getIn().setHeader("CamelGoogleDrive.content", fileMetadata);
                exchange.getIn().setHeader("CamelGoogleDrive.mediaContent", mediaContent);
            }
            return fileMetadata;
View Full Code Here


   
   
    protected File uploadTestFile() {
        File fileMetadata = new File();
        fileMetadata.setTitle(UPLOAD_FILE.getName());
        FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
       
        final Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is com.google.api.services.drive.model.File
        headers.put("CamelGoogleDrive.content", fileMetadata);
        // parameter type is com.google.api.client.http.AbstractInputStreamContent
View Full Code Here

        // File's new metadata.
        file.setTitle("camel.png");

        // File's new content.
        java.io.File fileContent = new java.io.File(TEST_UPLOAD_IMG);
        FileContent mediaContent = new FileContent(null, fileContent);

        // Send the request to the API.
       
        final Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is String
View Full Code Here

            // Upload new apk to developer console
            final String apkPath = BasicUploadApk.class
                    .getResource(ApplicationConfig.APK_FILE_PATH)
                    .toURI().getPath();
            final AbstractInputStreamContent apkFile =
                    new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
            Upload uploadRequest = edits
                    .apks()
                    .upload(ApplicationConfig.PACKAGE_NAME,
                            editId,
                            apkFile);
View Full Code Here

            // Upload new apk to developer console
            final String apkPath = UploadApkWithListing.class
                    .getResource(ApplicationConfig.APK_FILE_PATH)
                    .toURI().getPath();
            final AbstractInputStreamContent apkFile =
                    new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
            Upload uploadRequest = edits
                    .apks()
                    .upload(ApplicationConfig.PACKAGE_NAME,
                            editId,
                            apkFile);
View Full Code Here

      final String editId = edit.getId();
      getLogger().info(String.format("Created edit with id: %s", editId));

      // Upload new apk to developer console
      final AbstractInputStreamContent apkFileContent =
          new FileContent(AndroidPublisherHelper.MIME_TYPE_APK,
              getReleaseApkFile(publisherExtension));
      Upload uploadRequest = edits
          .apks()
          .upload(publisherExtension.getPackageName(),
              editId,
View Full Code Here

  File body = new File();   
  body.setTitle("My document");   
  body.setDescription("A test document");   
  body.setMimeType("text/plain");       
  java.io.File fileContent = new java.io.File("document.txt");   
  FileContent mediaContent = new FileContent("text/plain", fileContent);   
  File file = service.files().insert(body, mediaContent).execute();   

System.out.println("File ID: " + file.getId())}}
View Full Code Here

    File body = new File();
    body.setTitle(file.getName());
    body.setMimeType("text/plain");
    body.setParents(newArrayList(new ParentReference().setId(getId())));

    FileContent mediaContent = new FileContent("text/plain", file);

    return drive.insert(body, mediaContent);
  }
View Full Code Here

            final String editId = edit.getId();
            log.info(String.format("Created edit with id: %s", editId));

            // Upload new apk to developer console
            final AbstractInputStreamContent apkFile =
                    new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, apkFiles);
            Upload uploadRequest = edits
                    .apks()
                    .upload(packageName,
                            editId,
                            apkFile);
View Full Code Here

      this.file = file;
    }

    @Override
    AbstractInputStreamContent mediaContentOf(String mimeType) {
      return new FileContent(mimeType, file);
    }
View Full Code Here

TOP

Related Classes of com.google.api.client.http.FileContent

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.