diff --git a/README.md b/README.md index 078cdca..5447f70 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,47 @@ ConnectionProperties connectionProperties .host("localhost") .port(9333) .maxConnection(100).build(); +// Apply properties +fileSource.setProperties(connectionProperties); // Startup manager and listens for the change fileSource.startup(); ``` ##### Create a file operation template +[SeaWeed Write Protocol](https://github.com/chrislusf/seaweedfs#write-file) ```java // Template used with connection manager FileTemplate template = new FileTemplate(fileSource.getConnection()); + template.saveFileByStream("filename.doc", someFile); ``` +##### Fetch a files content +[SeaWeed Read Protocol](https://github.com/chrislusf/seaweedfs#read-file) +```java +// This is the value returned by assign (dir/assign) when you write a file +// https://github.com/chrislusf/seaweedfs#write-file +String fileId = "3,01637037d6"; + +FileTemplate template = new FileTemplate(fileSource.getConnection()); + +StreamResponse fileStream = template.getFileStream(fileId); +// Will print the content within the file +System.out.println("File Content: " + fileStream.getOutputStream()); +``` + +##### Fetching File Handlers (Name, Size, LastModified, Content Type) +```java +// This is the value returned by assign (dir/assign) when you write a file +// https://github.com/chrislusf/seaweedfs#write-file +String fileId = "3,01637037d6"; + +FileTemplate template = new FileTemplate(fileSource.getConnection()); + +FileHandleStatus fileStatus = template.getFileStatus(fileHandleStatus.getFileId()); +System.out.println("File Name: " + fileStatus.getFileName()); +``` + ## License The Apache Software License, Version 2.0 diff --git a/pom.xml b/pom.xml index 4464a0e..73a070e 100644 --- a/pom.xml +++ b/pom.xml @@ -39,9 +39,8 @@ UTF-8 - 2.10.3 - 4.5.10 - 3.1.1 + 2.11.1 + 4.5.12 4.3.1.RELEASE 4.11 @@ -110,6 +109,15 @@ 28.2-jre + + + com.github.ben-manes.caffeine + caffeine + 2.8.5 + + + + @@ -138,4 +146,4 @@ - \ No newline at end of file +