fanyi2

HttpURLconnection

An URLConnection for HTTP (RFC 2616) used to send and receive data over the web. Data may be of any type and length. This class may be used to send and receive streaming data whose length is not known in advance. 

Uses of this class follow a pattern: 

  1. Obtain a new HttpURLConnection by calling URL.openConnection() and casting the result to        HttpURLConnection.   
  2. Prepare the request. The primary property of a request is its URI.       Request headers may also include metadata such as credentials, preferred       content types, and session cookies.   
  3. Optionally upload a request body. Instances must be configured with        setDoOutput(true) if they include a       request body. Transmit data by writing to the stream returned by getOutputStream().   
  4. Read the response. Response headers typically include metadata such as       the response body's content type and length, modified dates and session       cookies. The response body may be read from the stream returned by getInputStream(). If the response has no body, that method returns an       empty stream.   
  5. Disconnect. Once the response body has been read, the HttpURLConnection should be closed by calling disconnect().       Disconnecting releases the resources held by a connection so they may       be closed or reused.

对于HTTP个URLConnection(RFC 2616)用于在网络上发送和接收数据。数据可以是任何类型和长度。这个类可以被用来发送和接收数据流的长度是事先不知道的。

使用这类遵循一个模式:

1。通过调用URL获取新HttpURLConnection。openconnection()铸造结果HttpURLConnection。

2制备的要求。一个请求的主要特性是它的URI。请求头还可包括元数据如凭据,首选的内容类型,和会话cookie。

3。选择上传请求正文。实例必须配置setdooutput(真的)如果他们包括请求正文。将数据写入流返回getoutputstream()。

4读取响应。响应头通常包括元数据如响应正文的内容类型和长度,修改日期和会话cookie。响应体可以从流读取返回的getinputstream()。如果响应没有身体,这个方法将返回一个空流。

5.disconnect。一旦身体反应已读,HttpURLConnection应该通过调用disconnect()关闭。断开连接释放所持有的所以他们可以被关闭或重复使用资源。

URLconnection

A connection to a URL for reading or writing. For HTTP connections, see  HttpURLConnection for documentation of HTTP-specific features.

一种用于读或写一个URL连接。对于HTTP连接,看到的HTTP特定功能的文档HttpURLConnection。

Handler

A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue.  Each Handler instance is associated with a single thread and that thread's message queue.  When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.

 一个处理程序允许你发送和线程的MessageQueue消息Runnable对象关联的进程。每个处理程序实例与一个线程和线程的消息队列相关的。当你创建一个新的处理程序,它必然是创建它的线程的线程/消息队列——从这一点上,它将提供信息和Runnables,消息队列和执行他们出来的消息队列。

Looper

Class used to run a message loop for a thread.  Threads by default do not have a message loop associated with them; to create one, call  prepare() in the thread that is to run the loop, and then  loop() to have it process messages until the loop is stopped.  

Most interaction with a message loop is through the  Handler class.

类用来运行一个线程的消息循环。线程默认情况下没有消息循环与他们有联系的;创造一个电话,那是运行环螺纹prepare(),然后loop()要处理消息直到循环停止。

大多数的互动与一个消息循环是通过处理类。

 

Message

Defines a message containing a description and arbitrary data object that can be sent to a Handler.  This object contains two extra int fields and an extra object field that allow you to not do allocations in many cases.

定义了一个包含一个描述和任意数据对象,可以被发送到一个处理器的消息。此对象包含两个额外的int域和一个额外的对象字段允许您不在许多情况下做分配。

MessageQueue

Low-level class holding the list of messages to be dispatched by a  Looper.  Messages are not added directly to a MessageQueue, but rather through MessageQueue.IdleHandler objects associated with the Looper.  

You can retrieve the MessageQueue for the current thread with  Looper.myQueue().

低年级保持消息列表被派遣一个弯。消息没有被直接添加到一个消息队列,而是通过与活套相关的messagequeue.idlehandler对象。

你可以检索与当前线程的MessageQueue活套myqueue()。

 


 

 

 

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值