connection = (HttpURLConnection) new URL(params[0]).openConnection();
connection.setRequestProperty("Cookie", mCookiesList.get(0) + ";" + mCookiesList.get(1));
connection.connect();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
`
答案 0 :(得分:0)
您可以使用javax.imageio.ImageIO类构造具有InputStream的BufferedImage:
BufferedImage bufferedImage = ImageIO.read(connection.getInputStream());
然后,如果您打算将磁盘写为位图:
int imageWithInPixels = 200;
int imageHeightInPixels = 200;
BufferedImage bitmapImage = new BufferedImage(imageWithInPixels , imageHeightInPixels , BufferedImage.TYPE_INT_RGB);
bitmapImage.getGraphics().drawImage(
bufferedImage , 0, 0, imageWithInPixels , imageHeightInPixels , null);
ImageIO.write(bitmapImage , "BMP", new File("filename.bmp"));