Package org.apache.jackrabbit.value
Class BinaryImpl
- java.lang.Object
-
- org.apache.jackrabbit.value.BinaryImpl
-
- All Implemented Interfaces:
javax.jcr.Binary
public class BinaryImpl extends java.lang.Object implements javax.jcr.Binary
BinaryImpl
implements theBinary
interface.
-
-
Constructor Summary
Constructors Constructor Description BinaryImpl(byte[] buffer)
Creates a newBinaryImpl
instance from abyte[]
array.BinaryImpl(java.io.InputStream in)
Creates a newBinaryImpl
instance from anInputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
long
getSize()
java.io.InputStream
getStream()
int
read(byte[] b, long position)
-
-
-
Constructor Detail
-
BinaryImpl
public BinaryImpl(java.io.InputStream in) throws java.io.IOException
Creates a newBinaryImpl
instance from anInputStream
. The contents of the stream is spooled to a temporary file or to a byte buffer if its size is smaller thanMAX_BUFFER_SIZE
.- Parameters:
in
- stream to be represented as aBLOBFileValue
instance- Throws:
java.io.IOException
- if an error occurs while reading from the stream or writing to the temporary file
-
BinaryImpl
public BinaryImpl(byte[] buffer)
Creates a newBinaryImpl
instance from abyte[]
array.- Parameters:
buffer
- byte array to be represented as aBinaryImpl
instance
-
-
Method Detail
-
getStream
public java.io.InputStream getStream() throws javax.jcr.RepositoryException
- Specified by:
getStream
in interfacejavax.jcr.Binary
- Throws:
javax.jcr.RepositoryException
-
read
public int read(byte[] b, long position) throws java.io.IOException, javax.jcr.RepositoryException
- Specified by:
read
in interfacejavax.jcr.Binary
- Throws:
java.io.IOException
javax.jcr.RepositoryException
-
getSize
public long getSize() throws javax.jcr.RepositoryException
- Specified by:
getSize
in interfacejavax.jcr.Binary
- Throws:
javax.jcr.RepositoryException
-
dispose
public void dispose()
- Specified by:
dispose
in interfacejavax.jcr.Binary
-
-