MicheleMarcon
asked on
How to open a FileInputStream from an URL?
I have this code that doesn't work:
SubstanceLookAndFeel.setCu rrentWater mark(new SubstanceImageWatermark(ne w FileInputStream(MyApp.clas s.getResou rce("image s/myimg.pn g"))));
Because getResources returns a URL, but FileInputStream can't open a file from a URL.
Of course, I use URL because I don't know the absolute location of my file.
How can I fix this?
SubstanceLookAndFeel.setCu
Because getResources returns a URL, but FileInputStream can't open a file from a URL.
Of course, I use URL because I don't know the absolute location of my file.
How can I fix this?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
MyApp.class.getResource("i