https://t.williamgates.net/image-E026_55A0B5BB.jpg
我尝试了 HttpURLConnection
和 HttpsURLConnection
,总是遇到这个异常:
javax.net.ssl.SSLException: Received fatal alert: internal_error
有人可以帮助解决这个问题吗?如果可以,请告诉我一些代码,谢谢!
最佳答案
我想这就是你需要的..
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
public class ReadImages {
public static void main(String[] args) {
try {
BufferedImage img = ImageIO.read(new URL("https://t.williamgates.net/image-E026_55A0B5BB.jpg").openStream());
ImageIO.write(img, "jpg", new File("image.jpg"));
} catch (IOException ex) {
Logger.getLogger(ReadImages.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
你应该引用以下类(class)
关于java - 我如何通过Java获取此HTTPS图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31358109/