public class JcrBinary extends 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.Modifier and Type | Field and Description |
---|---|
static javax.jcr.Binary |
EMPTY |
Constructor and Description |
---|
JcrBinary(byte[] buffer)
Creates a new
JcrBinary instance from a byte[]
array. |
JcrBinary(InputStream in)
Creates a new
JcrBinary instance from an
InputStream . |
public JcrBinary(InputStream in) throws IOException
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.in
- stream to be represented as a JcrBinary
instanceIOException
- if an error occurs while reading from the stream or writing
to the temporary filepublic JcrBinary(byte[] buffer)
JcrBinary
instance from a byte[]
array.buffer
- byte array to be represented as a JcrBinary
instancepublic InputStream getStream() throws javax.jcr.RepositoryException
getStream
in interface javax.jcr.Binary
javax.jcr.RepositoryException
public int read(byte[] b, long position) throws IOException, javax.jcr.RepositoryException
read
in interface javax.jcr.Binary
IOException
javax.jcr.RepositoryException
public long getSize() throws javax.jcr.RepositoryException
getSize
in interface javax.jcr.Binary
javax.jcr.RepositoryException
public void dispose()
dispose
in interface javax.jcr.Binary
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.