org.apache.chemistry.opencmis.jcr
Class JcrBinary
java.lang.Object
org.apache.chemistry.opencmis.jcr.JcrBinary
- All Implemented Interfaces:
- javax.jcr.Binary
public class JcrBinary
- extends java.lang.Object
- implements javax.jcr.Binary
JcrBinary
implements the JCR Binary
interface.
This is mostly a copy from org.apache.jackrabbit.value.BinaryImpl in
Apache Jackrabbit's jcr-commons module.
Field Summary |
static javax.jcr.Binary |
EMPTY
|
Constructor Summary |
JcrBinary(byte[] buffer)
Creates a new JcrBinary instance from a byte[] array. |
JcrBinary(java.io.InputStream in)
Creates a new JcrBinary instance from an InputStream . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY
public static final javax.jcr.Binary EMPTY
JcrBinary
public JcrBinary(java.io.InputStream in)
throws java.io.IOException
- Creates a new
JcrBinary
instance from an InputStream
.
The contents of the stream is spooled to a temporary file or to a byte buffer
if its size is smaller than MAX_BUFFER_SIZE
.
The input stream is closed by this implementation.
- Parameters:
in
- stream to be represented as a JcrBinary
instance
- Throws:
java.io.IOException
- if an error occurs while reading from the stream or
writing to the temporary file
JcrBinary
public JcrBinary(byte[] buffer)
- Creates a new
JcrBinary
instance from a byte[]
array.
- Parameters:
buffer
- byte array to be represented as a JcrBinary
instance
getStream
public java.io.InputStream getStream()
throws javax.jcr.RepositoryException
- Specified by:
getStream
in interface javax.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 interface javax.jcr.Binary
- Throws:
java.io.IOException
javax.jcr.RepositoryException
getSize
public long getSize()
throws javax.jcr.RepositoryException
- Specified by:
getSize
in interface javax.jcr.Binary
- Throws:
javax.jcr.RepositoryException
dispose
public void dispose()
- Specified by:
dispose
in interface javax.jcr.Binary
Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.