clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject git commit: CLEREZZA-883: added public constructor taking File
Date Fri, 28 Feb 2014 15:00:55 GMT
Repository: clerezza
Updated Branches:
  refs/heads/master aabf26c1a -> 2c92e727f


CLEREZZA-883: added public constructor taking File

Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/2c92e727
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/2c92e727
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/2c92e727

Branch: refs/heads/master
Commit: 2c92e727f6a1b74a781ac24c9c28a7190cff2db1
Parents: aabf26c
Author: retobg <reto@apache.org>
Authored: Fri Feb 28 16:00:42 2014 +0100
Committer: retobg <reto@apache.org>
Committed: Fri Feb 28 16:00:42 2014 +0100

----------------------------------------------------------------------
 .../apache/clerezza/rdf/file/storage/FileMGraph.java   | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/clerezza/blob/2c92e727/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
----------------------------------------------------------------------
diff --git a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
index 5d79924..bc2fea1 100644
--- a/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
+++ b/rdf.file.storage/src/main/java/org/apache/clerezza/rdf/file/storage/FileMGraph.java
@@ -51,8 +51,11 @@ public class FileMGraph extends SimpleMGraph {
 
     FileMGraph(UriRef uri, Parser parser,
             Serializer serializer) {
-        file = new File(URI.create(uri.getUnicodeString()));
-        String fileEnding = extractFileEnding(uri);
+        this(new File(URI.create(uri.getUnicodeString())), parser, serializer);    
+    }
+
+    public FileMGraph(File file, Parser parser, Serializer serializer) {
+        String fileEnding = extractFileEnding(file.getPath());
         fileType = getMediaTypeForFileEnding(fileEnding);
         this.serializer = serializer;
         try {
@@ -65,8 +68,7 @@ public class FileMGraph extends SimpleMGraph {
             }
         } catch (IOException e) {
             throw new RuntimeException(e);
-        }
-    }
+        }    }
     
     @Override
     public boolean add(Triple e) {
@@ -154,8 +156,7 @@ public class FileMGraph extends SimpleMGraph {
         return modified;
     }
 
-    private String extractFileEnding(UriRef uri) {
-        String uriString = uri.getUnicodeString();
+    private String extractFileEnding(String uriString) {
         String fileEnding = uriString.substring(uriString.lastIndexOf(".") + 1, uriString.length());
         return fileEnding;
     }


Mime
View raw message