|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.value.BLOBFileValue
BLOBFileValue
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.
javax.jcr.ValueFactory
to create binary values.
Field Summary | |
protected static String |
DEFAULT_ENCODING
the default encoding |
static int |
TYPE
the property type |
Constructor Summary | |
BLOBFileValue(byte[] bytes)
Creates a new BLOBFileValue instance from a
byte[] array. |
|
BLOBFileValue(File file)
Creates a new BLOBFileValue instance from a File . |
|
BLOBFileValue(FileSystemResource fsResource)
Creates a new BLOBFileValue instance from a resource in the
virtual file system. |
|
BLOBFileValue(InputStream in)
Creates a new BLOBFileValue instance from an
InputStream . |
Method Summary | |
void |
delete()
Deletes the persistent resource backing this BLOBFileValue . |
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)
|
boolean |
getBoolean()
|
Calendar |
getDate()
|
double |
getDouble()
|
long |
getLength()
Returns the length of this BLOBFileValue . |
long |
getLong()
|
InputStream |
getStream()
|
String |
getString()
|
int |
getType()
|
int |
hashCode()
Returns zero to satisfy the Object equals/hashCode contract. |
void |
spool(OutputStream out)
Spools the contents of this BLOBFileValue to the given
output stream. |
String |
toString()
Returns the path string of the backing file. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int TYPE
protected static final String DEFAULT_ENCODING
Constructor Detail |
public BLOBFileValue(InputStream in) throws IOException
BLOBFileValue
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
.
in
- stream to be represented as a BLOBFileValue
instance
IOException
- if an error occurs while reading from the stream or
writing to the temporary filepublic BLOBFileValue(byte[] bytes)
BLOBFileValue
instance from a
byte[]
array.
bytes
- byte array to be represented as a BLOBFileValue
instancepublic BLOBFileValue(File file) throws IOException
BLOBFileValue
instance from a File
.
file
- file to be represented as a BLOBFileValue
instance
IOException
- if the file can not be readpublic BLOBFileValue(FileSystemResource fsResource) throws IOException
BLOBFileValue
instance from a resource in the
virtual file system.
fsResource
- resource in virtual file system
IOException
- if the resource can not be readMethod Detail |
public long getLength()
BLOBFileValue
.
BLOBFileValue
,
or -1L if the length can't be determined.public void discard()
BLOBFileValue
is backed by a persistent resource
calling this method will have no effect.
delete()
,
delete(boolean)
public void delete()
BLOBFileValue
.
Same as #delete(false)
.
If this BLOBFileValue
is not backed by a persistent
resource calling this method will have no effect.
discard()
public void delete(boolean pruneEmptyParentDirs)
BLOBFileValue
.
pruneEmptyParentDirs
- if true
, empty parent directories
will automatically be deletedpublic void spool(OutputStream out) throws RepositoryException, IOException
BLOBFileValue
to the given
output stream.
out
- output stream
RepositoryException
- if the input stream for this
BLOBFileValue
could not be obtained
IOException
- if an error occurs while while spoolingpublic String toString()
public boolean equals(Object obj)
public int hashCode()
Object.hashCode()
public int getType()
getType
in interface Value
public String getString() throws ValueFormatException, IllegalStateException, RepositoryException
getString
in interface Value
ValueFormatException
IllegalStateException
RepositoryException
public InputStream getStream() throws IllegalStateException, RepositoryException
getStream
in interface Value
IllegalStateException
RepositoryException
public double getDouble() throws ValueFormatException, IllegalStateException, RepositoryException
getDouble
in interface Value
ValueFormatException
IllegalStateException
RepositoryException
public Calendar getDate() throws ValueFormatException, IllegalStateException, RepositoryException
getDate
in interface Value
ValueFormatException
IllegalStateException
RepositoryException
public long getLong() throws ValueFormatException, IllegalStateException, RepositoryException
getLong
in interface Value
ValueFormatException
IllegalStateException
RepositoryException
public boolean getBoolean() throws ValueFormatException, IllegalStateException, RepositoryException
getBoolean
in interface Value
ValueFormatException
IllegalStateException
RepositoryException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |