In short: I want to cast a byte array or String into a File object, so that I can use this File object as a parameter for a method whose signature I can not change. I want to achieve this in-memory, without ever touching a drive.
I have read many similar questions here, including suggestions about using File.createTempFile, but I get the impression we're still creating physical files then, even if it's only temporary?
In full: I am helping with a very complex data recovery project. We now have a, let's say, disk image of over 400GB, which is a collection of 2MB-sections. Some of the files I want to recover begin in one, and end in another 2MB-section. We have an inventory of where we've seen beginnings and endings, so now I want to stitch beginnings and endings together, and then check whether the result is a valid file, in some propretary format. (this is all background information, let's please not get into that!)
I have a java class (that I can't change) that can read and therefore verify these files. So I want to simply feed my put-together-file into this method. If it is succesful, I move on to the next "begin-part", otherwise I try to match the begin-part with a different end-part.
I want to keep the 'stitched together files' in memory (not write it to temporary files) because it's probably clear that I need high efficiency. This is a last resort; indeed, we need to match many thousands of beginnings with many thousands of endings. But again, let's just keep to the question :)