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 intCOPYBUFFER_LENGTHjava.lang.StringfileNamejava.lang.Stringi_extinti_length
-
Constructor Summary
Constructors Constructor Description BlobImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intadjustReadDepth(int depth)java.lang.ObjectcreateDefault(Transaction a_trans)voiddeleteFile()Deletes the current file stored in this BLOB.java.io.FileInputStreamgetClientInputStream()java.io.FileOutputStreamgetClientOutputStream()java.lang.StringgetFileName()returns the name of the file the blob was stored to.intgetLength()doublegetStatus()returns the status after the last read- or write-operation.voidgetStatusFrom(BlobStatus from)booleanhasClassIndex()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.java.io.FileserverFile(java.lang.String promptName, boolean writeToServer)voidsetObjectReference(ObjectReference objectReference)voidsetStatus(double status)voidsetTrans(Transaction a_trans)voidwriteLocal(java.io.File file)writes stored blob data to a file.voidwriteTo(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:
createDefaultin 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:Blobreturns the name of the file the blob was stored to.
The method may return null, if the file was never stored.- Specified by:
getFileNamein interfaceBlob- Returns:
- String the name of the file.
-
getLength
public int getLength()
-
getStatus
public double getStatus()
Description copied from interface:Blobreturns 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.
-
getStatusFrom
public void getStatusFrom(BlobStatus from)
-
hasClassIndex
public boolean hasClassIndex()
- Specified by:
hasClassIndexin interfaceDb4oTypeImpl
-
readFrom
public void readFrom(java.io.File file) throws java.io.IOExceptionDescription copied from interface:Blobreads 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.IOExceptionDescription copied from interface:Blobreads 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:
setTransin interfaceTransactionAware
-
writeLocal
public void writeLocal(java.io.File file) throws java.io.IOExceptionDescription copied from interface:Blobwrites stored blob data to a file.
db4o will use the local file system in Client/Server mode also.- Specified by:
writeLocalin 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.IOExceptionDescription copied from interface:Blobwrites 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:
setObjectReferencein interfaceDb4oTypeImpl
-
deleteFile
public void deleteFile() throws java.io.IOExceptionDescription copied from interface:BlobDeletes the current file stored in this BLOB.- Specified by:
deleteFilein interfaceBlob- Throws:
java.io.IOException- in case of errors and in case no data was stored
-
-