Class SimpleReferenceBinary
- java.lang.Object
-
- org.apache.jackrabbit.commons.jackrabbit.SimpleReferenceBinary
-
- All Implemented Interfaces:
Binary
,ReferenceBinary
public class SimpleReferenceBinary extends java.lang.Object implements ReferenceBinary
-
-
Constructor Summary
Constructors Constructor Description SimpleReferenceBinary(java.lang.String reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Releases all resources associated with thisBinary
object and informs the repository that these resources may now be reclaimed.java.lang.String
getReference()
Returns a secure reference to this binary, ornull
if such a reference is not available.long
getSize()
Returns the size of thisBinary
value in bytes.java.io.InputStream
getStream()
Returns anInputStream
representation of this value.int
read(byte[] b, long position)
Reads successive bytes from the specifiedposition
in thisBinary
into the passed byte array until either the byte array is full or the end of theBinary
is encountered.
-
-
-
Method Detail
-
getReference
public java.lang.String getReference()
Description copied from interface:ReferenceBinary
Returns a secure reference to this binary, ornull
if such a reference is not available.- Specified by:
getReference
in interfaceReferenceBinary
- Returns:
- binary reference, or
null
-
getStream
public java.io.InputStream getStream() throws RepositoryException
Description copied from interface:Binary
Returns anInputStream
representation of this value. Each call togetStream()
returns a new stream. The API consumer is responsible for callingclose()
on the returned stream.If
Binary.dispose()
has been called on thisBinary
object, then this method will throw the runtime exceptionIllegalStateException
.- Specified by:
getStream
in interfaceBinary
- Returns:
- A stream representation of this value.
- Throws:
RepositoryException
- if an error occurs.
-
read
public int read(byte[] b, long position) throws java.io.IOException, RepositoryException
Description copied from interface:Binary
Reads successive bytes from the specifiedposition
in thisBinary
into the passed byte array until either the byte array is full or the end of theBinary
is encountered.If
Binary.dispose()
has been called on thisBinary
object, then this method will throw the runtime exceptionIllegalStateException
.- Specified by:
read
in interfaceBinary
- Parameters:
b
- the buffer into which the data is read.position
- the position in this Binary from which to start reading bytes.- Returns:
- the number of bytes read into the buffer, or -1 if there is no more data because the end of the Binary has been reached.
- Throws:
java.io.IOException
- if an I/O error occurs.RepositoryException
- if another error occurs.
-
getSize
public long getSize() throws RepositoryException
Description copied from interface:Binary
Returns the size of thisBinary
value in bytes.If
Binary.dispose()
has been called on thisBinary
object, then this method will throw the runtime exceptionIllegalStateException
.- Specified by:
getSize
in interfaceBinary
- Returns:
- the size of this value in bytes.
- Throws:
RepositoryException
- if an error occurs.
-
dispose
public void dispose()
Description copied from interface:Binary
Releases all resources associated with thisBinary
object and informs the repository that these resources may now be reclaimed. An application should call this method when it is finished with theBinary
object.
-
-