转字符串:
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String result = "";
while((line=in.readLine()) != null ) result+=line;
写入文件
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());
FileOutputStream fos = new FileOutputStream(new File("E:\\13.jpg"));
byte[] buf = new byte[1024];
int size = 0;
while ((size = bis.read(buf)) != -1)
fos.write(buf, 0, size);
fos.close();
ossClient.putObject(bucketName, key, bis);
bis.close();
关于inputStream和Reader的区别,见java学习笔记(五):文件IO