當前位置: 首頁>>代碼示例>>Java>>正文


Java Result類代碼示例

本文整理匯總了Java中io.minio.Result的典型用法代碼示例。如果您正苦於以下問題:Java Result類的具體用法?Java Result怎麽用?Java Result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Result類屬於io.minio包,在下文中一共展示了Result類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import io.minio.Result; //導入依賴的package包/類
/**
 * MinioClient.removeObject() example removing multiple objects.
 */
public static void main(String[] args)
  throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
  try {
    /* play.minio.io for test and development. */
    MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F",
                                              "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

    /* Amazon S3: */
    // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
    //                                           "YOUR-SECRETACCESSKEY");

    List<String> objectNames = new LinkedList<String>();
    objectNames.add("my-objectname1");
    objectNames.add("my-objectname2");
    objectNames.add("my-objectname3");

    // Remove object all objects 'objectNames' list from 'my-bucketname'.
    for (Result<DeleteError> errorResult: minioClient.removeObject("my-bucketname", objectNames)) {
      DeleteError error = errorResult.get();
      System.out.println("Failed to remove '" + error.objectName() + "'. Error:" + error.message());
    }
  } catch (MinioException e) {
    System.out.println("Error occurred: " + e);
  }
}
 
開發者ID:minio,項目名稱:minio-java,代碼行數:29,代碼來源:RemoveObjects.java

示例2: listAlbums

import io.minio.Result; //導入依賴的package包/類
public List<Album> listAlbums() throws NoSuchAlgorithmException,
        IOException, InvalidKeyException, XmlPullParserException, MinioException {

    List<Album> list = new ArrayList<Album>();
    final String minioBucket = "albums";

    // Initialize minio client object.
    MinioClient minioClient = new MinioClient("play.minio.io", 9000,
                                              "Q3AM3UQ867SPQQA43P2F",
                                              "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

    // List all objects.
    Iterable<Result<Item>> myObjects = minioClient.listObjects(minioBucket);

    // Iterate over each elements and set album url.
    for (Result<Item> result : myObjects) {
        Item item = result.get();
        System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName());

        // Generate a presigned URL which expires in a day
        url = minioClient.presignedGetObject(minioBucket, item.objectName(), 60 * 60 * 24);
         
        // Create a new Album Object
        Album album = new Album();
        
        // Set the presigned URL in the album object
        album.setUrl(url);
        
        // Add the album object to the list holding Album objects
        list.add(album);
        
    }

    // Return list of albums.
    return list;
}
 
開發者ID:minio,項目名稱:minio-java-rest-example,代碼行數:37,代碼來源:AlbumDao.java

示例3: main

import io.minio.Result; //導入依賴的package包/類
/**
 * MinioClient.listIncompleteUploads() example.
 */
public static void main(String[] args)
  throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
  try {
    /* play.minio.io for test and development. */
    MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F",
                                              "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

    /* Amazon S3: */
    // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
    //                                           "YOUR-SECRETACCESSKEY");

    // Check whether 'my-bucketname' exist or not.
    boolean found = minioClient.bucketExists("my-bucketname");
    if (found) {
      // List all incomplete multipart upload of objects in 'my-bucketname'
      Iterable<Result<Upload>> myObjects = minioClient.listIncompleteUploads("my-bucketname");
      for (Result<Upload> result : myObjects) {
        Upload upload = result.get();
        System.out.println(upload.uploadId() + ", " + upload.objectName());
      }
    } else {
      System.out.println("my-bucketname does not exist");
    }
  } catch (MinioException e) {
    System.out.println("Error occurred: " + e);
  }
}
 
開發者ID:minio,項目名稱:minio-java,代碼行數:31,代碼來源:ListIncompleteUploads.java

示例4: main

import io.minio.Result; //導入依賴的package包/類
/**
 * MinioClient.listObjects() example.
 */
public static void main(String[] args)
  throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
  try {
    /* play.minio.io for test and development. */
    MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F",
                                              "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

    /* Amazon S3: */
    // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
    //                                           "YOUR-SECRETACCESSKEY");

    // Check whether 'my-bucketname' exist or not.
    boolean found = minioClient.bucketExists("my-bucketname");
    if (found) {
      // List objects from 'my-bucketname'
      Iterable<Result<Item>> myObjects = minioClient.listObjects("my-bucketname");
      for (Result<Item> result : myObjects) {
        Item item = result.get();
        System.out.println(item.lastModified() + ", " + item.size() + ", " + item.objectName());
      }
    } else {
      System.out.println("my-bucketname does not exist");
    }
  } catch (MinioException e) {
    System.out.println("Error occurred: " + e);
  }
}
 
開發者ID:minio,項目名稱:minio-java,代碼行數:31,代碼來源:ListObjects.java


注:本文中的io.minio.Result類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。