public class DefaultConvertStrategy extends java.lang.Object implements ConvertStrategy
Constructor and Description |
---|
DefaultConvertStrategy(com.mongodb.gridfs.GridFS gridFS,
VCounter counter)
Constructs a new convert strategy
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
convert(long oid)
Load the binary data with the given OID and convert it back to
an object
|
long |
convert(java.lang.Object data)
Convert the given data to a binary object and return the
replacement OID
|
java.util.List<com.mongodb.gridfs.GridFSInputFile> |
getConvertedFiles() |
public DefaultConvertStrategy(com.mongodb.gridfs.GridFS gridFS, VCounter counter)
gridFS
- the MongoDB GridFS storing binary datacounter
- a counter to generate replacement OIDspublic java.util.List<com.mongodb.gridfs.GridFSInputFile> getConvertedFiles()
public long convert(java.lang.Object data)
ConvertStrategy
convert
in interface ConvertStrategy
data
- the data to convertpublic java.lang.Object convert(long oid) throws java.io.IOException
ConvertStrategy
convert
in interface ConvertStrategy
oid
- the OIDjava.io.IOException
- if the binary data could not be read