jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1560888 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
Date Fri, 24 Jan 2014 02:17:51 GMT
Author: jukka
Date: Fri Jan 24 02:17:51 2014
New Revision: 1560888

URL: http://svn.apache.org/r1560888
Log:
OAK-834: Efficient copying of binaries across repositories

Implement SegmentBlob.getReference() based on the external value feature from OAK-1333

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java?rev=1560888&r1=1560887&r2=1560888&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentBlob.java
Fri Jan 24 02:17:51 2014
@@ -99,7 +99,17 @@ class SegmentBlob extends Record impleme
 
     @Override @CheckForNull
     public String getReference() {
-        return null;
+        Segment segment = getSegment();
+        int offset = getOffset();
+        if ((segment.readByte(offset) & 0xf0) == 0xe0) {
+            // 1110 xxxx: external value
+            int length = segment.readShort(offset) & 0x0fff;
+            byte[] bytes = new byte[length];
+            segment.readBytes(offset + 10, bytes, 0, length);
+            return new String(bytes, UTF_8);
+        } else {
+            return null;
+        }
     }
 
     //------------------------------------------------------------< Object >--



Mime
View raw message