Package com.db4o.types
Interface Blob
-
- All Superinterfaces:
Db4oType
- All Known Implementing Classes:
BlobImpl
public interface Blob extends Db4oType
the db4o Blob type to store blobs independent of the main database file and allows to perform asynchronous upload and download operations.
Usage:
- Define Blob fields on your user classes.
- As soon as an object of your class is stored, db4o automatically takes care that the Blob field is set.
- Call readFrom to read a blob file into the db4o system.
- Call writeTo to write a blob file from within the db4o system.
- getStatus may help you to determine, whether data has been previously stored. It may also help you to track the completion of the current process.
db4o client/server carries out all blob operations in a separate thread on a specially dedicated socket. One socket is used for all blob operations and operations are queued. Your application may continue to access db4o while a blob is transferred in the background.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeleteFile()Deletes the current file stored in this BLOB.java.lang.StringgetFileName()returns the name of the file the blob was stored to.doublegetStatus()returns the status after the last read- or write-operation.voidreadFrom(java.io.File file)reads a file into the db4o system and stores it as a blob.voidreadLocal(java.io.File file)reads a file into the db4o system and stores it as a blob.voidwriteLocal(java.io.File file)writes stored blob data to a file.voidwriteTo(java.io.File file)writes stored blob data to a file.
-
-
-
Method Detail
-
getFileName
java.lang.String getFileName()
returns the name of the file the blob was stored to.
The method may return null, if the file was never stored.- Returns:
- String the name of the file.
-
getStatus
double getStatus()
returns the status after the last read- or write-operation.
The status value returned may be any of the following:
Status.UNUSEDno data was ever stored to the Blob field.
Status.AVAILABLEavailable data was previously stored to the Blob field.
Status.QUEUEDan operation was triggered and is waiting for it's turn in the Blob queue.
Status.COMPLETEDthe last operation on this field was completed successfully.
Status.PROCESSINGfor internal use only.
Status.ERRORthe last operation failed.
or a double between 0 and 1 that signifies the current completion percentage of the currently running operation.
the fiveStatusconstants defined in this interface or a double between 0 and 1 that signifies the completion of the currently running operation.- Returns:
- status - the current status
- See Also:
constants
-
readFrom
void readFrom(java.io.File file) throws java.io.IOExceptionreads a file into the db4o system and stores it as a blob.
In Client/Server mode db4o will open an additional socket and process writing data in an additional thread.- Parameters:
file- the file the blob is to be read from.- Throws:
java.io.IOException- in case of errors
-
readLocal
void readLocal(java.io.File file) throws java.io.IOExceptionreads a file into the db4o system and stores it as a blob.
db4o will use the local file system in Client/Server mode also.- Parameters:
file- the file the blob is to be read from.- Throws:
java.io.IOException- in case of errors
-
writeLocal
void writeLocal(java.io.File file) throws java.io.IOExceptionwrites stored blob data to a file.
db4o will use the local file system in Client/Server mode also.- Parameters:
file- the file the blob is to be written to.- Throws:
java.io.IOException- in case of errors and in case no blob data was stored
-
writeTo
void writeTo(java.io.File file) throws java.io.IOExceptionwrites stored blob data to a file.
In Client/Server mode db4o will open an additional socket and process writing data in an additional thread.- Parameters:
file- the file the blob is to be written to.- Throws:
java.io.IOException- in case of errors and in case no blob data was stored
-
deleteFile
void deleteFile() throws java.io.IOExceptionDeletes the current file stored in this BLOB.- Throws:
java.io.IOException- in case of errors and in case no data was stored
-
-