Reset to default
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
ImageIO.read(*...) will only load these image types GIF, PNG, JPEG, BMP, and WBMP.
Any other image type will return
null without error.
I do realize this is not a solution to the specific original problem but it is a solution to the question asked.
ImageIO.read(file); will return null if no registered ImageReader is found. Please check whether you have registered any ImageReader.
I think this code snippet could help you
File file = new File("bear.jpg"); // I have bear.jpg in my working directory FileInputStream fis = new FileInputStream(file); BufferedImage image = ImageIO.read(fis); //reading the image file
You just need to wrap the file into an FileInputStream and then pass it to read()
Try wrap you InputStream into BufferedInputStream:
fis = new FileInputStream(file); ==>
new BufferedInputStream(new FileInputStream(file));
Add the following dependencies:
<dependency> <groupId>com.github.jai-imageio</groupId> <artifactId>jai-imageio-core</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>com.github.jai-imageio</groupId> <artifactId>jai-imageio-jpeg2000</artifactId> <version>1.4.0</version> </dependency>