有人可以检查下面的代码,看看是否有更好的做法。我真正担心的是性能,我有这个吗?如果没有,我可以做些什么来提高代码的可读性?
try {
URL url = new URL("http://www.pudim.com.br/SiteBuilder/UploadUsers/pudim.com.br/pudim.jpg");
URLConnection uc = url.openConnection();
String type = uc.getContentType();
BufferedImage image = ImageIO.read(url);
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", os);
byte[] bytes = os.toByteArray();
InputStream is = new ByteArrayInputStream(bytes);
// not important :) ...
} catch (AmazonServiceException e) {
e.printStackTrace();
} catch (AmazonClientException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
欢迎任何考虑。
谢谢!