不终止java / eclipse控制台中的打印变量

时间:2015-03-01 14:12:05

标签: java eclipse google-drive-api

我正在尝试在Google云端硬盘中打印某个文件的权限。 在运行代码时,控制台不会打印出我们的结果,它只是说。

这部分有问题吗? :

System.out.println(permissions.getItems());

我试过了几件事,但我不明白为什么不打印出来。

public class GoogleDriveListPermission {

  public static void main(String[] args) throws IOException, GeneralSecurityException, URISyntaxException {

    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();


    GoogleCredential credential = new GoogleCredential.Builder()
        .setTransport(httpTransport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountPrivateKeyFromP12File(new java.io.File("eclipsejava-kjd7991s.p12"))
        .setServiceAccountUser("admin@domain.com")
        .setServiceAccountId("8969872333158-oj1ioad24f9t89da7sdfyhj2k@developer.gserviceaccount.com")
        .setServiceAccountScopes(Arrays.asList(DriveScopes.DRIVE))    
        .build();


        Drive service = new Drive.Builder(httpTransport, jsonFactory, credential)
            .setApplicationName("Google Drive App1")
            .build();

}
  public static String fileId = "12u4QfIIOkM9rpoQvSrstMI8-3EJvZYp3jw1Gp3NSz";
  public static String newOwner = "113598691748107335"; 

  public static List<Permission> retrievePermissions(Drive service,
          String fileId) {
        try {
          PermissionList permissions = service.permissions().list(fileId).execute();

          System.out.println(permissions.getItems());

          return permissions.getItems();


        } catch (IOException e) {
          System.out.println("An error occurred: " + e);
        }

        return null;
      }



}

0 个答案:

没有答案
相关问题