S3 NIO2 filesystem implementation
This project is maintained by bytemechanics
S3 Filesystem is a library to convert S3 protocol to a NIO2 filesystem Warning: This library does not accomplish the zero-dependencies objective
Utility to test the concept of create a virtual filesystem from s3 service
<dependency>
<groupId>org.bytemechanics.filesystem</groupId>
<artifactId>s3-nio-filesystem</artifactId>
<version>X.X.X</version>
</dependency>
dependencies {
compile 'org.bytemechanics.filesystem:s3-nio-filesystem:X.X.X'
}
package mypackage;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
public class S3FileSystemTest {
private static final String S3URI="s3://{0}:{1}@192.168.56.1:9000";
private static final String S3USER="9OIA67H2VBDP5T62ZCHK";
private static final String S3PASSWORD="7a0iE4IHHeE5Curn8SJJG7Xe5a3plQ/YZ5sgedEM";
private static final String S3BUCKET="es-spl";
private static final long PROPERTY_MULTIPART_UPLOAD_MINSIZE=Long.MAX_VALUE;
private static final long PROPERTY_CONNECTION_TIMEOUT=100l;
private FileSystem fileSystem;
public void S3FileSystemTest() throws IOException{
Map<String,String> environment= new HashMap<>();
environment.put(S3FileSystemEnvironment.PROPERTY_MULTIPART_UPLOAD_MINSIZE.name(),String.valueOf(PROPERTY_MULTIPART_UPLOAD_MINSIZE));
environment.put(S3FileSystemEnvironment.PROPERTY_CONNECTION_TIMEOUT.name(),String.valueOf(PROPERTY_CONNECTION_TIMEOUT));
String encodedUser=URLEncoder.encode(S3USER,"UTF-8");
String encodedPassword=URLEncoder.encode(S3PASSWORD,"UTF-8");
URI uri=URI.create(MessageFormat.format("s3://{0}:{1}@192.168.56.1:9000/{2}",encodedUser,encodedPassword,S3BUCKET));
fileSystem=FileSystems.newFileSystem(uri,environment);
}
}
Path path=this.fileSystem.getPath("test.pdf");