2
votes

Why does the following code give me a File Not Found exception when i try to create an InputStream? My inputdirectory is defined as a File and has a value of "D:\General\Images\small_images" (without quotes) that my user has full write permissions to. I'm using Windows 7 and running through the eclipse IDE as administrator.

File outputDirectory = new File(inputDirectory + "/" + imageSize.name());
if (!outputDirectory.exists()) {
    outputDirectory.mkdir();
}
**InputStream input = new FileInputStream(outputDirectory);**

Any help would be appreciated.

2
you just created a new empty directory and you want to open an input stream? what do you expect to find there the read?Sharon Ben Asher

2 Answers

2
votes

an InputStream expects an existing file, not directory.

0
votes

You are trying to read a directory and that is not allowed.