<pre class="java" name="code"> public InputStream getInputStream(String url) throws IOException{
URL _url = new URL(url);
HttpURLConnection conn = (HttpURLConnection) _url.openConnection();//基于HTTP协议连接对象
conn.setConnectTimeout(5000);
conn.setRequestMethod("GET");
return conn.getInputStream();
}
public byte[] getBytesFromInputStream(InputStream inStream) throws IOException{
ByteArrayOutputStream out=new ByteArrayOutputStream();
byte[] buffer=new byte[1024];
int length=0;
while((length=inStream.read(buffer))!=-1){
out.write(buffer);
}
inStream.close();
return out.toByteArray();
}<pre class="java" name="code"> public InputStre