1. InputStream OutPutStream
可以将网络文件转成url,然后通过url.openConnection().getOutputStream(),获取对url的输出流,若对url要输入流,也可以url.getinputStream,格式为inputStream
OutputStream os = url.openConnection().getOutputStream();
InputStream is = file.getInputStream();
byte[] bytes = new byte[1024];
int c;
// 暂未考虑中途终止的情况
while ((c = is.read(bytes)) != -1) {
os.write(bytes, 0, c);
}
os.flush();
is.close();
os.close();