All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.nio.spi.s3.S3XFileSystemProvider Maven / Gradle / Ivy

Go to download

A Java NIO.2 service provider for S3, allowing Java NIO operations to be performed on paths using the `s3` scheme. This package implements the service provider interface (SPI) defined for Java NIO.2 in JDK 1.7 providing "plug-in" non-blocking access to S3 objects for Java applications using Java NIO.2 for file access.

The newest version!
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

package software.amazon.nio.spi.s3;

import java.net.URI;
import software.amazon.nio.spi.s3.util.S3FileSystemInfo;
import software.amazon.nio.spi.s3.util.S3XFileSystemInfo;

public class S3XFileSystemProvider extends S3FileSystemProvider {

    static final String SCHEME = "s3x";

    /**
     * Returns the URI scheme that identifies this provider.
     *
     * @return The URI scheme (s3x)
     */
    @Override
    public String getScheme() {
        return SCHEME;
    }

    /**
     * This overrides the default AWS implementation to be able to address 3rd
     * party S3 services. To do so, we relax the default S3 URI format to the
     * following:
     * {@code
     * s3x://[accessKey:accessSecret@]endpoint/bucket/key
     * }
     *
     * Please note that the authority part of the URI (endpoint above) is always
     * considered a HTTP(S) endpoint, therefore the name of the bucket is the
     * first element of the path. The remaining path elements will be the object
     * key.
     *
     * @param uri the URI to extract the information from
     *
     * @return the information extracted from {@code uri}
     */
    @Override
    S3FileSystemInfo fileSystemInfo(URI uri) {
        return new S3XFileSystemInfo(uri);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy