org.apache.jackrabbit.core.value
Class BLOBValue

java.lang.Object
  extended by org.apache.jackrabbit.core.value.BLOBFileValue
      extended by org.apache.jackrabbit.core.value.BLOBValue

public class BLOBValue
extends BLOBFileValue

This class represents a binary value which is backed by a resource or byte[]. Unlike BinaryValue it has no state, i.e. the getStream() method always returns a fresh InputStream instance.


Method Summary
 void delete(boolean pruneEmptyParentDirs)
          Deletes the persistent resource backing this BLOBFileValue.
 void discard()
          Frees temporarily allocated resources such as temporary file, buffer, etc.
 boolean equals(Object obj)
          
 long getLength()
          Returns the length of this BLOBFileValue.
 InputStream getStream()
          Returns an InputStream representation of this value.
 int hashCode()
          Returns zero to satisfy the Object equals/hashCode contract.
 String toString()
          Returns a string representation of this BLOBFileValue instance.
 
Methods inherited from class org.apache.jackrabbit.core.value.BLOBFileValue
spool
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getLength

public long getLength()
Returns the length of this BLOBFileValue.

Specified by:
getLength in class BLOBFileValue
Returns:
The length, in bytes, of this BLOBFileValue, or -1L if the length can't be determined.

discard

public void discard()
Frees temporarily allocated resources such as temporary file, buffer, etc. If this BLOBFileValue is backed by a persistent resource calling this method will have no effect.

Specified by:
discard in class BLOBFileValue
See Also:
delete(boolean)

delete

public void delete(boolean pruneEmptyParentDirs)
Deletes the persistent resource backing this BLOBFileValue.

Specified by:
delete in class BLOBFileValue
Parameters:
pruneEmptyParentDirs - if true, empty parent directories will automatically be deleted

toString

public String toString()
Returns a string representation of this BLOBFileValue instance. The string representation of a resource backed value is the path of the underlying resource. If this instance is backed by an in-memory buffer the generic object string representation of the byte array will be used instead.

Specified by:
toString in class BLOBFileValue
Returns:
A string representation of this BLOBFileValue instance.

equals

public boolean equals(Object obj)

Specified by:
equals in class BLOBFileValue

hashCode

public int hashCode()
Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.

Specified by:
hashCode in class BLOBFileValue
Returns:
always zero
See Also:
Object.hashCode()

getStream

public InputStream getStream()
                      throws IllegalStateException,
                             RepositoryException
Returns an InputStream representation of this value.

Specified by:
getStream in class BLOBFileValue
Returns:
An InputStream representation of this value.
Throws:
IllegalStateException
RepositoryException


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.