I'm trying to write a function which returns a file input stream. It looks something like this:
public FileInputStream getFileInputStream() {
File file;
try {
file = new File("somepath");
} catch (Exception e) {
}
FileInputStream fInputStream = new FileInputStream(file);
return fInputStream;
}
So here is my problem - obviously a file isn't created in the case of an exception. But I NEED a file object to instantiate the FileInputStream. I'm kind of lost here, how can I handle the exception while still returning a valid FileInputStream object?