I was puzzled recently as to why the code I had was throwing an IO FileNotFound error when I had
but worked when I simply used
There is a constructor for Streamresult that takes a File object which I though was correct in the first example. can someone explain what is happeneing here. I would have expected the file to be created with the transformed data in my C drive using example one ...Also , would it be right to say that the second example which works is using the constructor for StrreamResult that takes a string (Construct a StreamResult from a URL.)...becasue such a constructor exists?
That second example is surely the constructor which expects a URL in String form. What you posted there isn't a URL, so I'm surprised that it worked. I'm also surprised that the first example didn't. My conclusion from all of that is that you have got your tests backwards; the first example should work (assuming that file exists) and the second should not.
Joined: Apr 04, 2009
Thanks for replying.
Yes it's strange and I checked again and the new File argument does indeed fail and the String URL one works and creates a file with that name in my project directory yet specifying new File("C:\\filename") causes an IO error and this location is fully writable.