Class SimpleReferenceBinary
- java.lang.Object
-
- org.apache.jackrabbit.commons.jackrabbit.SimpleReferenceBinary
-
- All Implemented Interfaces:
Binary,ReferenceBinary
public class SimpleReferenceBinary extends Object implements ReferenceBinary
-
-
Constructor Summary
Constructors Constructor Description SimpleReferenceBinary(String reference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Releases all resources associated with thisBinaryobject and informs the repository that these resources may now be reclaimed.StringgetReference()Returns a secure reference to this binary, ornullif such a reference is not available.longgetSize()Returns the size of thisBinaryvalue in bytes.InputStreamgetStream()Returns anInputStreamrepresentation of this value.intread(byte[] b, long position)Reads successive bytes from the specifiedpositionin thisBinaryinto the passed byte array until either the byte array is full or the end of theBinaryis encountered.
-
-
-
Constructor Detail
-
SimpleReferenceBinary
public SimpleReferenceBinary(String reference)
-
-
Method Detail
-
getReference
public String getReference()
Description copied from interface:ReferenceBinaryReturns a secure reference to this binary, ornullif such a reference is not available.- Specified by:
getReferencein interfaceReferenceBinary- Returns:
- binary reference, or
null
-
getStream
public InputStream getStream() throws RepositoryException
Description copied from interface:BinaryReturns anInputStreamrepresentation 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 thisBinaryobject, then this method will throw the runtime exceptionIllegalStateException.- Specified by:
getStreamin interfaceBinary- Returns:
- A stream representation of this value.
- Throws:
RepositoryException- if an error occurs.
-
read
public int read(byte[] b, long position) throws IOException, RepositoryExceptionDescription copied from interface:BinaryReads successive bytes from the specifiedpositionin thisBinaryinto the passed byte array until either the byte array is full or the end of theBinaryis encountered.If
Binary.dispose()has been called on thisBinaryobject, then this method will throw the runtime exceptionIllegalStateException.- Specified by:
readin 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:
IOException- if an I/O error occurs.RepositoryException- if another error occurs.
-
getSize
public long getSize() throws RepositoryExceptionDescription copied from interface:BinaryReturns the size of thisBinaryvalue in bytes.If
Binary.dispose()has been called on thisBinaryobject, then this method will throw the runtime exceptionIllegalStateException.- Specified by:
getSizein interfaceBinary- Returns:
- the size of this value in bytes.
- Throws:
RepositoryException- if an error occurs.
-
dispose
public void dispose()
Description copied from interface:BinaryReleases all resources associated with thisBinaryobject and informs the repository that these resources may now be reclaimed. An application should call this method when it is finished with theBinaryobject.
-
-