Howto use DefaultBinaryManager ?
I need to retrieve the filesystem's filename of the principal blob of a document. I would like to use the code below to retrieve this info :
String digest = blob.getDigest(); DefaultBinaryManager manager = ???? ; File file = manager.getFileForDigest(digest, false); String name = file.getName();
But I don't know how to initialise “manager”.
Is this the good way to do it ?
How can I get the instance of DefaultBinaryManager ?
You shouldn't do that because you're accessing the internals of the blob storage which may change at any time. However, given the above, if you really want to do it you can do:
Binary binary = ((SQLBlob) blob).getBinary(); File file = ((FileSource) binary.getStreamSource()).getFile()