I have a function that accepts File as an argument. I don't want to create/write a new File (I don't have write access to filesystem) in order to pass my string data to the function. I should add that the String data don't exist in a file (so I cannot read my data from a file).
Can I use Streams and "cast" them to File objects?
Fileobject? As the answers have stated, aFileobject is like a reference to a location in the filesystem, and so would be hard to simulate without an actual file. If, however, your function took aFileReaderor aFileInputStream, you could easily modify the code to accept non-file input.