Giter Club home page Giter Club logo

doctest's Introduction

Minio Java Library for Amazon S3 Compatible Cloud Storage Gitter

The Minio Java Client SDK provides simple APIs to access any Amazon S3 compatible object storage server.

This quickstart guide will show you how to install the client SDK and execute an example java program. For a complete list of APIs and examples, please take a look at the Java Client API Reference documentation.

This document assumes that you have one of the following Java Environments setup in place.

Download from maven

<dependency>
        <groupId>io.minio</groupId>
        <artifactId>minio</artifactId>
        <version>2.0.0</version>
</dependency>

Download from gradle

dependencies {
compile 'io.minio:minio:2.0.0'
}


    look at my html stuff here


Download from JAR

You can download the latest JAR directly from maven.

Quick Start Example - File Uploader

This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket.

You need three items in order to connect to an object storage server.

MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");
Params Description
Endpoint URL to object storage service.
Access Key Access key is like user ID that uniquely identifies your account.
Secret Key Secret key is the password to your account.

We will use the Minio server running at https://play.minio.io:9000 in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

FileUploader.java

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException;
import org.xmlpull.v1.XmlPullParserException;
import io.minio.MinioClient;
import io.minio.errors.MinioException;
        
public class FileUploader {
        public static void main(String[] args) throws NoSuchAlgorithmException, IOException, InvalidKeyException, XmlPullParserException {
                try {
                        // Create a minioClient with the Minio Server name, Port, Access key and Secret key.
                        MinioClient minioClient = new MinioClient("https://play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");
    
                        // Check if the bucket already exists.
                        boolean isExist = minioClient.bucketExists("asiatrip");
                        if(isExist) {
                                System.out.println("Bucket already exists.");
                        } else {
                                // Make a new bucket called asiatrip to hold a zip file of photos.
                                minioClient.makeBucket("asiatrip");
                        }
    
                        // Upload the zip file to the bucket with putObject
                        minioClient.putObject("asiatrip","asiaphotos.zip", "/tmp/asiaphotos.zip");
                        System.out.println("/tmp/asiaphotos.zip is successfully uploaded as asiaphotos.zip in asiatrip bucket.");
                } catch(MinioException e) {
                        System.out.println("Error occured: " + e);
                }
        }
}

Compile FileUploader

$ javac -cp "minio-2.0.0.jar"  FileUploader.java

Run FileUploader

$ java -cp "minio-2.0.0.jar" FileUploader.java
/tmp/asiaphotos.zip is successfully uploaded as asiaphotos.zip in asiatrip bucket.

$  mc ls play/asiatrip/
[2016-06-02 18:10:29 PDT]  82KiB asiaphotos.zip
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

API Reference

The full API Reference is available here.

API Reference : Bucket Operations

API Reference : Object Operations

API Reference : Presigned Operations

Full Examples

Full Examples : Bucket Operations

Full Eamples : Object Operations

Full Examples : Presigned Operations

How to run these full examples?

Simply edit the example java program to include your access credentials and follow the steps below.

NOTE: minio-2.0.0-all.jar includes all the necessary dependencies to run these examples.

$ sudo apt-get install openjdk-7-jdk
$ git clone https://github.com/minio/minio-java
$ cd minio-java
[edit examples/ListBuckets.java]
$ cd minio-java/examples; wget http://repo1.maven.org/maven2/io/minio/minio/2.0.0/minio-2.0.0-all.jar;
$ javac -cp 'minio-2.0.0-all.jar' ListBuckets.java
$ java -cp '.:minio-2.0.0-all.jar' ListBuckets
bucket1
bucket2
....
...
bucketN

Explore Further

Contribute

Contributors Guide

Build Status Build status

doctest's People

Contributors

deekoder avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.