jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1336714 - in /jackrabbit/oak/trunk: oak-it/jcr/pom.xml oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java
Date Thu, 10 May 2012 14:21:41 GMT
Author: reschke
Date: Thu May 10 14:21:41 2012
New Revision: 1336714

URL: http://svn.apache.org/viewvc?rev=1336714&view=rev
Log:
OAK-16: implement random access in BinaryImpl

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1336714&r1=1336713&r2=1336714&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Thu May 10 14:21:41 2012
@@ -46,7 +46,6 @@
               <value>
 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetPrimaryItem
 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID
-org.apache.jackrabbit.test.api.BinaryPropertyTest#testRandomAccess
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUIDFailure
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID
 org.apache.jackrabbit.test.api.PathTest#testGetItem

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java?rev=1336714&r1=1336713&r2=1336714&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/BinaryImpl.java
Thu May 10 14:21:41 2012
@@ -55,8 +55,15 @@ class BinaryImpl implements Binary {
 
     @Override
     public int read(byte[] b, long position) throws IOException, RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("implementation missing");
+        InputStream stream = value.unwrap().getNewStream();
+        try {
+            if (position != stream.skip(position)) {
+                throw new IOException("Can't skip to position " + position);
+            }
+            return stream.read(b);
+        } finally {
+            stream.close();
+        }
     }
 
     @Override



Mime
View raw message