Package com.db4o.internal
Class BlobImpl
- java.lang.Object
-
- com.db4o.internal.BlobImpl
-
- All Implemented Interfaces:
Db4oTypeImpl
,TransactionAware
,Blob
,Db4oType
,java.lang.Cloneable
public class BlobImpl extends java.lang.Object implements Blob, java.lang.Cloneable, Db4oTypeImpl
Transfer of blobs to and from the db4o system, if users use the Blob Db4oType.
-
-
Field Summary
Fields Modifier and Type Field Description static int
COPYBUFFER_LENGTH
java.lang.String
fileName
java.lang.String
i_ext
int
i_length
-
Constructor Summary
Constructors Constructor Description BlobImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
adjustReadDepth(int depth)
java.lang.Object
createDefault(Transaction a_trans)
void
deleteFile()
Deletes the current file stored in this BLOB.java.io.FileInputStream
getClientInputStream()
java.io.FileOutputStream
getClientOutputStream()
java.lang.String
getFileName()
returns the name of the file the blob was stored to.int
getLength()
double
getStatus()
returns the status after the last read- or write-operation.void
getStatusFrom(BlobStatus from)
boolean
hasClassIndex()
void
readFrom(java.io.File file)
reads a file into the db4o system and stores it as a blob.void
readLocal(java.io.File file)
reads a file into the db4o system and stores it as a blob.java.io.File
serverFile(java.lang.String promptName, boolean writeToServer)
void
setObjectReference(ObjectReference objectReference)
void
setStatus(double status)
void
setTrans(Transaction a_trans)
void
writeLocal(java.io.File file)
writes stored blob data to a file.void
writeTo(java.io.File file)
writes stored blob data to a file.
-
-
-
Field Detail
-
COPYBUFFER_LENGTH
public static final int COPYBUFFER_LENGTH
- See Also:
- Constant Field Values
-
fileName
public java.lang.String fileName
-
i_ext
public java.lang.String i_ext
-
i_length
public int i_length
-
-
Method Detail
-
adjustReadDepth
public int adjustReadDepth(int depth)
- Parameters:
depth
-
-
createDefault
public java.lang.Object createDefault(Transaction a_trans)
- Specified by:
createDefault
in interfaceDb4oTypeImpl
-
getClientInputStream
public java.io.FileInputStream getClientInputStream() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getClientOutputStream
public java.io.FileOutputStream getClientOutputStream() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getFileName
public java.lang.String getFileName()
Description copied from interface:Blob
returns the name of the file the blob was stored to.
The method may return null, if the file was never stored.- Specified by:
getFileName
in interfaceBlob
- Returns:
- String the name of the file.
-
getLength
public int getLength()
-
getStatus
public double getStatus()
Description copied from interface:Blob
returns the status after the last read- or write-operation.
The status value returned may be any of the following:
Status.UNUSED
no data was ever stored to the Blob field.
Status.AVAILABLE
available data was previously stored to the Blob field.
Status.QUEUED
an operation was triggered and is waiting for it's turn in the Blob queue.
Status.COMPLETED
the last operation on this field was completed successfully.
Status.PROCESSING
for internal use only.
Status.ERROR
the last operation failed.
or a double between 0 and 1 that signifies the current completion percentage of the currently running operation.
the fiveStatus
constants defined in this interface or a double between 0 and 1 that signifies the completion of the currently running operation.
-
getStatusFrom
public void getStatusFrom(BlobStatus from)
-
hasClassIndex
public boolean hasClassIndex()
- Specified by:
hasClassIndex
in interfaceDb4oTypeImpl
-
readFrom
public void readFrom(java.io.File file) throws java.io.IOException
Description copied from interface:Blob
reads 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.
-
readLocal
public void readLocal(java.io.File file) throws java.io.IOException
Description copied from interface:Blob
reads a file into the db4o system and stores it as a blob.
db4o will use the local file system in Client/Server mode also.
-
serverFile
public java.io.File serverFile(java.lang.String promptName, boolean writeToServer) throws java.io.IOException
- Throws:
java.io.IOException
-
setStatus
public void setStatus(double status)
-
setTrans
public void setTrans(Transaction a_trans)
- Specified by:
setTrans
in interfaceTransactionAware
-
writeLocal
public void writeLocal(java.io.File file) throws java.io.IOException
Description copied from interface:Blob
writes stored blob data to a file.
db4o will use the local file system in Client/Server mode also.- Specified by:
writeLocal
in interfaceBlob
- 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
public void writeTo(java.io.File file) throws java.io.IOException
Description copied from interface:Blob
writes stored blob data to a file.
In Client/Server mode db4o will open an additional socket and process writing data in an additional thread.
-
setObjectReference
public void setObjectReference(ObjectReference objectReference)
- Specified by:
setObjectReference
in interfaceDb4oTypeImpl
-
deleteFile
public void deleteFile() throws java.io.IOException
Description copied from interface:Blob
Deletes the current file stored in this BLOB.- Specified by:
deleteFile
in interfaceBlob
- Throws:
java.io.IOException
- in case of errors and in case no data was stored
-
-