package cn.cctv.net;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
publicclass ImageRequest {
/**
* @param args
*/
publicstaticvoid main(String[] args) throws Exception {
//new一个URL对象
URL url = new URL("http://img.hexun.com/2011-06-21/130726386.jpg");
//打开链接
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
//设置请求方式为"GET"
conn.setRequestMethod("GET");
//超时响应时间为5秒
conn.setConnectTimeout(5 * 1000);
//通过输入流获取图片数据
InputStream inStream = conn.getInputStream();
//得到图片的二进制数据,以二进制封装得到数据,具有通用性
byte[] data = readInputStream(inStream);
//new一个文件对象用来保存图片,默认保存当前工程根目录
File p_w_picpathFile = new File("BeautyGirl.jpg");
//创建输出流
FileOutputStream outStream = new FileOutputStream(p_w_picpathFile);
//写入数据
outStream.write(data);
//关闭输出流
outStream.close();
}
publicstaticbyte[] readInputStream(InputStream inStream) throws Exception{
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
//创建一个Buffer字符串
byte[] buffer = newbyte[1024];
//每次读取的字符串长度,如果为-1,代表全部读取完毕
int len = 0;
//使用一个输入流从buffer里把数据读取出来
while( (len=inStream.read(buffer)) != -1 ){
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
outStream.write(buffer, 0, len);
}
//关闭输入流
inStream.close();
//把outStream里的数据写入内存
return outStream.toByteArray();
}
}
*************************************************************************************
在Java中可以使用HttpURLConnection发起这两种请求,了解此类,对于了解soap,和编写servlet的自动测试代码都有很大的帮助。
下面的代码简单描述了如何使用HttpURLConnection发起这两种请求,以及传递参数的方法:
![ExpandedBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
上面的 readContentFromGet()函数产生了一个get请求,传给servlet一个username参数,值为"fat man"。
readContentFromPost()函数产生了一个post请求,传给servlet一个firstname参数,值为"一个大肥人"。
HttpURLConnection.connect函数,实际上只是建立了一个与服务器的tcp连接,并没有实际发送http请求。无论是post还是get,http请求实际上直到 HttpURLConnection .getInputStream()这个函数里面才正式发送出去。
在 readContentFromPost()中,顺序是重中之重,对connection对象的一切配置(那一堆set函数)都必须要在connect()函数执行之前完成。而对outputStream的写操作,又必须要在inputStream的读操作之前。这些顺序实际上是由http请求的格式决定的。
http请求实际上由两部分组成,一个是http头,所有关于此次http请求的配置都在http头里面定义,一个是正文content,在connect()函数里面,会根据HttpURLConnection对象的配置值生成http头,因此在调用connect函数之前,就必须把所有的配置准备好。
紧接着http头的是http请求的正文,正文的内容通过outputStream写入,实际上outputStream不是一个网络流,充其量是个字符串流,往里面写入的东西不会立即发送到网络,而是在流关闭后,根据输入的内容生成http正文。
至此,http请求的东西已经准备就绪。在getInputStream()函数调用的时候,就会把准备好的http请求正式发送到服务器了,然后返回一个输入流,用于读取服务器对于此次http请求的返回信息。由于http请求在getInputStream的时候已经发送出去了(包括http头和正文),因此在getInputStream()函数之后对connection对象进行设置(对http头的信息进行修改)或者写入outputStream(对正文进行修改)都是没有意义的了,执行这些操作会导致异常的发生。
************************************************************************************
本节深入学习post请求。
上节说道,post请求的OutputStream实际上不是网络流,而是写入内存,在getInputStream中才真正把写道流里面的内容作为正文与根据之前的配置生成的http request头合并成真正的http request,并在此时才真正向服务器发送。
HttpURLConnection.setChunkedStreamingMode函数可以改变这个模式,设置了ChunkedStreamingMode后,不再等待OutputStream关闭后生成完整的http request一次过发送,而是先发送http request头,正文内容则是网路流的方式实时传送到服务器。实际上是不告诉服务器http正文的长度,这种模式适用于向服务器传送较大的或者是不容易获取长度的数据,如文件。下面以一段代码讲解一下,请与 Http学习之使用HttpURLConnection发送post和get请求中的readContentFromPost()函数作对比:
![ExpandedBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
***********************************************************************************
根据GET请求的路径信息和设定的工作目录拼成页面文件的物理路径,去读取页面并返回,如果该路径指向的文件不存在,或者不为html文件,则返回404页面,如果是非法的请求(如POST)则直接干掉连接
![wink_smile.gif](http://blog.csdn.net/Editor/FCKeditor/editor/p_w_picpaths/smiley/msn/wink_smile.gif)
具体代码如下:
![ExpandedBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![None.gif](/syntaxhighlighting/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
![ExpandedBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![ExpandedSubBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![InBlock.gif](/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![ExpandedBlockEnd.gif](/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
转载于:https://blog.51cto.com/longx/1350818