Package com.google.api.services.drive

Examples of com.google.api.services.drive.Drive.files()


  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


    out.close();
    documentIS.close();

    FileContent mediaContent = new FileContent(mimeType, fileContent);

    Insert insert = driveService.files().insert(body, mediaContent);
    insert.getMediaHttpUploader().setDirectUploadEnabled(true);
    File file = insert.setConvert(true).execute();

    return file;
  }
View Full Code Here

   * @throws IOException
   */
  public File getFile(String fileId) throws IOException, GeneralSecurityException {
    Drive driveService = getDriveService();

    return driveService.files().get(fileId).execute();
  }

  /**
   * Get file content from Google Drive
   *
 
View Full Code Here

   * @throws IOException
   */
  public void removeFileInGoogleDrive(String fileId) throws IOException, GeneralSecurityException {
    Drive driveService = getDriveService();

    driveService.files().delete(fileId).execute();
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.