`
isiqi
  • 浏览: 16077001 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

java.net.URLConnection翻译

阅读更多
<!-- ========= START OF TOP NAVBAR ======= --><!-- -->
JavaTM2Platform
Std.Ed. v1.4.2
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->

java.net
Class URLConnection

java.lang.Object
  extended byjava.net.URLConnection
Direct Known Subclasses:
HttpURLConnection, JarURLConnection

public abstract class URLConnection
extends Object

The abstract class URLConnection is the superclass of all classes that represent a communications link between the application and a URL. Instances of this class can be used both to read from and to write to the resource referenced by the URL. In general, creating a connection to a URL is a multistep process: 抽象类URLConnection是所有表示应用程序和URL之间通信链接的类的父类。该类的实例可以用来向URL表示的资源读取或写入。 通常创建一个URL连接是个多步骤进程:

openConnection()connect()
Manipulate parameters that affect the connection to the remote resource. 操作影响远程资源连接的参数。 Interact with the resource; query header fields and contents. 和资源交互,查询头字段和内容。
---------------------------->
time
  1. The connection object is created by invoking the openConnection method on a URL. 通过调用URL的openConnection方法返回连接对象。
  2. The setup parameters and general request properties are manipulated. 配置参数和通用请求属性。
  3. The actual connection to the remote object is made, using the connect method. 使用connect方法进行与远程对象的实际连接。
  4. The remote object becomes available. The header fields and the contents of the remote object can be accessed. 远程对象成为可用。远程对象的头字段和内容可以被访问。

The setup parameters are modified using the following methods: 使用以下方法修改配置参数:

  • setAllowUserInteraction
  • setDoInput
  • setDoOutput
  • setIfModifiedSince
  • setUseCaches

and the general request properties are modified using the method: 使用该方法修改通用请求属性:

  • setRequestProperty

Default values for the AllowUserInteraction and UseCaches parameters can be set using the methods setDefaultAllowUserInteraction and setDefaultUseCaches. AllowUserInteraction和UseCaches参数的默认值可以使用setDefaultAllowUserInteraction和setDefaultUseCaches方法来设置。

Each of the above set methods has a corresponding get method to retrieve the value of the parameter or general request property. The specific parameters and general request properties that are applicable are protocol specific. 以上每一个set方法都有一个对应的get方法来获取参数或者通用请求属性的值。特定的参数和适当的通用请求属性是协议特有的。

The following methods are used to access the header fields and the contents after the connection is made to the remote object: 在与远程对象建立连接后使用以下方法访问头字段和内容:

  • getContent
  • getHeaderField
  • getInputStream
  • getOutputStream

Certain header fields are accessed frequently. The methods: 某些头字段经常被访问。它们是:

  • getContentEncoding
  • getContentLength
  • getContentType
  • getDate
  • getExpiration
  • getLastModifed

provide convenient access to these fields. The getContentType method is used by the getContent method to determine the type of the remote object; subclasses may find it convenient to override the getContentType method. 提供这些字段的便捷访问。getContentType方法由getContent方法实用类确定远程对象的类型, 子类可以方便地覆盖getContentType方法。

In the common case, all of the pre-connection parameters and general request properties can be ignored: the pre-connection parameters and request properties default to sensible values. For most clients of this interface, there are only two interesting methods: getInputStream and getContent, which are mirrored in the URL class by convenience methods. 通常情况下,所有预连接变量和通用请求属性可以被忽略:预连接变量和请求属性默认为敏感值。 对于大部分客户端接口,只有两个方法有意义:getInputStream和getContent, 这些便捷方法是对URL类中的映射。

More information on the request properties and header fields of an http connection can be found at: 请求属性和http连接的头字段的更多信息可以参见:

 http://www.ietf.org/rfc/rfc2068.txt
 
Note about fileNameMap: In versions prior to JDK 1.1.6, field fileNameMap of URLConnection was public. In JDK 1.1.6 and later, fileNameMap is private; accessor and mutator methods getFileNameMap and setFileNameMap are added to access it. This change is also described on the Compatibility page. Calling the close() methods on the InputStream or OutputStream of an URLConnection after a request may free network resources associated with this instance, unless particular protocol specifications specify different behaviours for it. 注意fileNameMap:在JDK 1.1.6之前的版本,URLConnection的fileNameMap域是公开的。在JDK 1.1.6 以后,fileNameMap是私有的。加入了getFileNameMap和setFileNameMap方法来访问和设置。 这些变化在Compatibility页中也有描述。在请求之后调用close()方法关闭InputStream或OutputStream 可以释放和实例相关的网络资源,除非特定的协议规范具体说明了行为的不同。

Since:
JDK1.0
See Also:
URL.openConnection(), connect(), getContent(), getContentEncoding(), getContentLength(), getContentType(), getDate(), getExpiration(), getHeaderField(int), getHeaderField(java.lang.String), getInputStream(), getLastModified(), getOutputStream(), setAllowUserInteraction(boolean), setDefaultUseCaches(boolean), setDoInput(boolean), setDoOutput(boolean), setIfModifiedSince(long), setRequestProperty(java.lang.String, java.lang.String), setUseCaches(boolean)

<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- -->

Field Summary
protected boolean allowUserInteraction
If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. 如果为true,此URL将在一定的上下文环境中被检验,是否允许用户交互,比如弹出一个认证对话框。
protected boolean connected
If false, this connection object has not created a communications link to the specified URL. 如果为false,此连接对象尚未创建到指定URL的通信链接。
protected boolean doInput
This variable is set by the setDoInput method. 该变量由setDoInput方法设置。
protected boolean doOutput
This variable is set by the setDoOutput method. 该变量由setDoOutput方法设置。
protected long ifModifiedSince
Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time. 一些协议支持忽略取回对象的操作,直到一定时间后对象被修改。
protected URL url
The URL represents the remote object on the World Wide Web to which this connection is opened. URL表示连接被打开的www上的远程对象。
protected boolean useCaches
If true, the protocol is allowed to use caching whenever it can. 如果为true,允许协议在可以使用缓存时使用缓存。
<!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- -->
Constructor Summary
protected URLConnection(URLurl)
Constructs a URL connection to the specified URL. 创建指定URL的URL连接。
<!-- ========== METHOD SUMMARY =========== --><!-- -->
Method Summary
void addRequestProperty(Stringkey, Stringvalue)
Adds a general request property specified by a key-value pair. 增加指定键-值对的通用请求属性。
abstract void connect()
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established. 打开此URL指向的资源的通信连接,如果这个连接尚未建立。
boolean getAllowUserInteraction()
Returns the value of the allowUserInteraction field for this object. 返回该对象allowUserInteraction域的值。
Object getContent()
Retrieves the contents of this URL connection. 获取此URL连接的内容。
Object getContent(Class[]classes)
Retrieves the contents of this URL connection. 获取此URL连接的内容。
String getContentEncoding()
Returns the value of the content-encoding header field. 返回content-encoding头字段值。
int getContentLength()
Returns the value of the content-length header field. 返回content-length头字段值。
String getContentType()
Returns the value of the content-type header field. 返回content-type头字段值。
long getDate()
Returns the value of the date header field. 返回date头字段值。
staticboolean getDefaultAllowUserInteraction()
Returns the default value of the allowUserInteraction field. 返回allowUserInteraction域默认值。
staticString getDefaultRequestProperty(Stringkey)
Deprecated.The instance specific getRequestProperty method should be used after an appropriate instance of URLConnection is obtained. 实例特定的getRequestProperty方法应当在获取适当的URLConnection实例后使用。
boolean getDefaultUseCaches()
Returns the default value of a URLConnection's useCaches flag. 返回URLConnection的useCaches标签的默认值。
boolean getDoInput()
Returns the value of this URLConnection's doInput flag. 返回URLConnection的doInput标签值。
boolean getDoOutput()
Returns the value of this URLConnection's doOutput flag. 返回URLConnection的doOutput标签值。
long getExpiration()
Returns the value of the expires header field. 返回expires头字段值。
staticFileNameMap getFileNameMap()
Loads filename map (a mimetable) from a data file. 从数据文件中加载文件名映射。
String getHeaderField(intn)
Returns the value for the nth header field. 返回nth头字段值。
String getHeaderField(Stringname)
Returns the value of the named header field. 返回指定名称的头字段值。
long getHeaderFieldDate(Stringname, longDefault)
Returns the value of the named field parsed as date. 返回解析为时间的指定名称的字段值。
int getHeaderFieldInt(Stringname, intDefault)
Returns the value of the named field parsed as a number. 返回解析为数字的指定名称的字段值。
String getHeaderFieldKey(intn)
Returns the key for the nth header field. 返回nth头字段的键值。
Map getHeaderFields()
Returns an unmodifiable Map of the header fields. 返回头字段的不可更改映射。
long getIfModifiedSince()
Returns the value of this object's ifModifiedSince field. 返回对象ifModifiedSince域的值。
InputStream getInputStream()
Returns an input stream that reads from this open connection. 返回从此打开连接读取的输入流。
long getLastModified()
Returns the value of the last-modified header field. 返回last-modified头字段值。
OutputStream getOutputStream()
Returns an output stream that writes to this connection. 返回向此连接写入的输出流。
Permission getPermission()
Returns a permission object representing the permission necessary to make the connection represented by this object. 返回表示发起此对象表示的连接所需的许可的许可对象。
Map getRequestProperties()
Returns an unmodifiable Map of general request properties for this connection. 返回此连接的通用请求属性的不可更改映射。
String getRequestProperty(Stringkey)
Returns the value of the named general request property for this connection. 返回此连接的指定名称的通用请求属性的值。
URL getURL()
Returns the value of this URLConnection's URL field. 获得URLConnection的URL域值。
boolean getUseCaches()
Returns the value of this URLConnection's useCaches field. 获得URLConnection的useCaches域值。
staticString guessContentTypeFromName(Stringfname)
Tries to determine the content type of an object, based on the specified "file" component of a URL. 根据URL的指定file组件,尝试确定对象的内容类型。
staticString guessContentTypeFromStream(InputStreamis)
Tries to determine the type of an input stream based on the characters at the beginning of the input stream. 根据输入流的起始字符,尝试确定输入流的类型。
void setAllowUserInteraction(booleanallowuserinteraction)
Set the value of the allowUserInteraction field of this URLConnection. 设置URLConnection的allowUserInteraction域值。
staticvoid setContentHandlerFactory(ContentHandlerFactoryfac)
Sets the ContentHandlerFactory of an application. 设置应用的ContentHandlerFactory。
staticvoid setDefaultAllowUserInteraction(booleandefaultallowuserinteraction)
Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value. 用指定值设置以后URLConnection对象的allowUserInteraction域默认值。
staticvoid setDefaultRequestProperty(Stringkey, Stringvalue)
Deprecated.The instance specific setRequestProperty method should be used after an appropriate instance of URLConnection is obtained. 实例特定的setRequestProperty方法应当在获取适当的URLConnection实例后使用。
void setDefaultUseCaches(booleandefaultusecaches)
Sets the default value of the useCaches field to the specified value. 用指定值设置useCaches域默认值。
void setDoInput(booleandoinput)
Sets the value of the doInput field for this URLConnection to the specified value. 用指定值设置此URLConnection的doInput域默认值。
void setDoOutput(booleandooutput)
Sets the value of the doOutput field for this URLConnection to the specified value. 用指定值设置此URLConnection的doOutput域默认值。
staticvoid setFileNameMap(FileNameMapmap)
Sets the FileNameMap. 设置FileNameMap。
void setIfModifiedSince(longifmodifiedsince)
Sets the value of the ifModifiedSince field of this URLConnection to the specified value. 用指定值设置此URLConnection的ifModifiedSince域默认值。
void setRequestProperty(Stringkey, Stringvalue)
Sets the general request property. 设置通用请求属性。
void setUseCaches(booleanusecaches)
Sets the value of the useCaches field of this URLConnection to the specified value. 用指定值设置此URLConnection的useCaches域默认值。
String toString()
Returns a String representation of this URL connection. 返回URL连接的String形式。
<!-- -->
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

<!-- ============ FIELD DETAIL =========== --><!-- -->

Field Detail
<!-- -->

url

protected URL url
The URL represents the remote object on the World Wide Web to which this connection is opened. URL表示连接被打开的www上的远程对象。

The value of this field can be accessed by the getURL method. 该域值getURL方法可以访问。

The default value of this variable is the value of the URL argument in the URLConnection constructor. 变量的默认值为URLConnection构造函数中的URL参数。

See Also:
getURL(), url

<!-- -->

doInput

protected boolean doInput
This variable is set by the setDoInput method. Its value is returned by the getDoInput method. 该变量由setDoInput方法设置。值由getDoInput方法返回。

A URL connection can be used for input and/or output. Setting the doInput flag to true indicates that the application intends to read data from the URL connection. URL连接可以用于输入输出。将doInput标签设置为true表示应用将从URL连接中读取数据。

The default value of this field is true. 该域的默认值为true。

See Also:
getDoInput(), setDoInput(boolean)

<!-- -->

doOutput

protected boolean doOutput
This variable is set by the setDoOutput method. Its value is returned by the getDoOutput method. 该变量由setDoOutput方法设置。值由getDoOutput方法返回。

A URL connection can be used for input and/or output. Setting the doOutput flag to true indicates that the application intends to write data to the URL connection. URL连接可以用于输入输出。将doOutput标签设置为true表示应用将向URL连接中写入数据。

The default value of this field is false. 该域的默认值为false。

See Also:
getDoOutput(), setDoOutput(boolean)

<!-- -->

allowUserInteraction

protected boolean allowUserInteraction
If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed. 如果为true,此URL将在一定的上下文环境中被检验,是否允许用户交互,比如弹出一个认证对话框。如果为 false,那么不允许用户交互。

The value of this field can be set by the setAllowUserInteraction method. Its value is returned by the getAllowUserInteraction method. Its default value is the value of the argument in the last invocation of the setDefaultAllowUserInteraction method. 域的值由setAllowUserInteraction方法设置。值由getAllowUserInteraction方法返回。默认值 为上次调用setDefaultAllowUserInteraction方法的参数值。

See Also:
getAllowUserInteraction(), setAllowUserInteraction(boolean), setDefaultAllowUserInteraction(boolean)

<!-- -->

useCaches

protected boolean useCaches
If true, the protocol is allowed to use caching whenever it can. If false, the protocol must always try to get a fresh copy of the object. 如果为true,允许协议在可以使用缓存时使用缓存。如果为false,协议应当总是尝试获取对象的最新拷贝。

This field is set by the setUseCaches method. Its value is returned by the getUseCaches method. 域由setUseCaches方法设置,值由getUseCaches方法返回。

Its default value is the value given in the last invocation of the setDefaultUseCaches method. 默认值为上次调用setDefaultUseCaches方法的参数值。

See Also:
setUseCaches(boolean), getUseCaches(), setDefaultUseCaches(boolean)

<!-- -->

ifModifiedSince

protected long ifModifiedSince
Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time. 一些协议支持忽略取回对象的操作,直到一定时间后对象被修改。

A nonzero value gives a time as the number of milliseconds since January 1, 1970, GMT. The object is fetched only if it has been modified more recently than that time. 非0值给出的是从GMT1970年1月1日起的毫秒数。只有对象在超过这个时间后被修改了,才取回对象。

This variable is set by the setIfModifiedSince method. Its value is returned by the getIfModifiedSince method. 变量由setIfModifiedSince方法设置,值由getIfModifiedSince方法返回。

The default value of this field is 0, indicating that the fetching must always occur. 域的默认值为0,表示取回始终发生。

See Also:
getIfModifiedSince(), setIfModifiedSince(long)

<!-- -->

connected

protected boolean connected
If false, this connection object has not created a communications link to the specified URL. If true, the communications link has been established. 如果为false,此连接对象尚未创建到指定URL的通信链接。如果为true,通信链接已经建立。

<!-- ========= CONSTRUCTOR DETAIL ======== --><!-- -->
Constructor Detail
<!-- -->

URLConnection

protected URLConnection(URLurl)
Constructs a URL connection to the specified URL. A connection to the object referenced by the URL is not created. 创建指定URL的URL连接。URL引用对象的连接不创建。

Parameters:
url - the specified URL. 指定URL。
<!-- ============ METHOD DETAIL ========== --><!-- -->
Method Detail
<!-- -->

getFileNameMap

public static FileNameMap getFileNameMap()
Loads filename map (a mimetable) from a data file. It will first try to load the user-specific table, defined by "content.types.user.table" property. If that fails, it tries to load the default built-in table at lib/content-types.properties under java home. 从数据文件中加载文件名映射。首先尝试加载由content.types.user.table属性定义的用户细节表。 如果失败,则尝试加载在java目录下的lib/content-types.properties中的内置表。

Returns:
the FileNameMap 文件名映射
Since:
1.2
See Also:
setFileNameMap(java.net.FileNameMap)

<!-- -->

setFileNameMap

public static void setFileNameMap(FileNameMapmap)
Sets the FileNameMap. 设置FileNameMap。

If there is a security manager, this method first calls the security manager's checkSetFactory method to ensure the operation is allowed. This could result in a SecurityException. 如果有安全管理器,方法首先调用安全管理器的checkSetFactory方法以确认操作允许。这可能导致SecurityException。

Parameters:
map - the FileNameMap to be set 要设置的FileNameMap
Throws:
SecurityException - if a security manager exists and its checkSetFactory method doesn't allow the operation. 如果安全管理器存在,它的checkSetFactory方法不允许该操作时抛出。
Since:
1.2
See Also:
SecurityManager.checkSetFactory(), getFileNameMap()

<!-- -->

connect

public abstract void connect()
                      throws IOException
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established. 打开此URL指向的资源的通信连接,如果这个连接尚未建立。

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored. 如果连接已经打开(connected域表示的值为true),调用被忽略。

URLConnection objects go through two phases: first they are created, then they are connected. After being created, and before being connected, various options can be specified (e.g., doInput and UseCaches). After connecting, it is an error to try to set them. Operations that depend on being connected, like getContentLength, will implicitly perform the connection, if necessary. URLConnection对象经过两个阶段:首先被创建,然后连接。创建后,且连接之前, 可以指定多种选项(比如doInput和UseCaches)。连接之后,试图设置它们则为一个错误。依赖于连接的操作,比如getContentLength,如果必需将默认为执行连接。

Throws:
IOException - if an I/O error occurs while opening the connection. 如果打开连接时发生I/O错误抛出。
See Also:
connected

<!-- -->

getURL

public URL getURL()
Returns the value of this URLConnection's URL field. 获得URLConnection的URL域值。

Returns:
the value of this URLConnection's URL field. URLConnection的URL域值。
See Also:
url

<!-- -->

getContentLength

public int getContentLength()
Returns the value of the content-length header field. 返回content-length头字段值。

Returns:
the content length of the resource that this connection's URL references, or -1 if the content length is not known. 连接URL引用资源的内容长度,如果内容长度未知返回-1。

<!-- -->

getContentType

public String getContentType()
Returns the value of the content-type header field. 返回content-type头字段值。

Returns:
the content type of the resource that the URL references, or null if not known. 连接URL引用资源的内容类型,如果未知返回null。
See Also:
getHeaderField(java.lang.String)

<!-- -->

getContentEncoding

public String getContentEncoding()
Returns the value of the content-encoding header field. 返回content-encoding头字段值。

Returns:
the content encoding of the resource that the URL references, or null if not known. 连接URL引用资源的内容编码,如果未知返回null。
See Also:
getHeaderField(java.lang.String)

<!-- -->

getExpiration

public long getExpiration()
Returns the value of the expires header field. 返回expires头字段值。

Returns:
the expiration date of the resource that this URL references, or 0 if not known. The value is the number of milliseconds since January 1, 1970 GMT. URL引用资源的过期时间,如果未知返回0。返回值为从GMT1970年1月1日起的毫秒数。
See Also:
getHeaderField(java.lang.String)

<!-- -->

getDate

public long getDate()
Returns the value of the date header field. 返回date头字段值。

Returns:
the sending date of the resource that the URL references, or 0 if not known. The value returned is the number of milliseconds since January 1, 1970 GMT. URL引用资源的发送时间,如果未知返回0。返回值为从GMT1970年1月1日起的毫秒数。
See Also:
getHeaderField(java.lang.String)

<!-- -->

getLastModified

public long getLastModified()
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT. 返回last-modified头字段值。结果为从GMT1970年1月1日起的毫秒数。

Returns:
the date the resource referenced by this URLConnection was last modified, or 0 if not known. URLConnection引用资源上次被修改的时间,未知返回0。
See Also:
getHeaderField(java.lang.String)

<!-- -->

getHeaderField

public String getHeaderField(Stringname)
Returns the value of the named header field. 返回指定名称的头字段值。

If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned. 如果使用不同值多次调用设置同样头的连接,则返回最新值。

Parameters:
name - the name of a header field. 头字段的名称。
Returns:
the value of the named header field, or null if there is no such field in the header. 指定名称的头字段值,如果没有那样的头字段返回null。

<!-- -->

getHeaderFields

public Map getHeaderFields()
Returns an unmodifiable Map of the header fields. The Map keys are Strings that represent the response-header field names. Each Map value is an unmodifiable List of Strings that represents the corresponding field values. 返回头字段的不可更改映射。Map的键值是一些字符串,表示响应头的字段名称。 每个Map值是一个不可更改的字符串列表,表示相应的字段值。

Returns:
a Map of header fields 头字段映射
Since:
1.4

<!-- -->

getHeaderFieldInt

public int getHeaderFieldInt(Stringname,
                             intDefault)
Returns the value of the named field parsed as a number. 返回解析为数字的指定名称的字段值。

This form of getHeaderField exists because some connection types (e.g., http-ng) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing. 因为一些连接类型(比如http-ng)已预解析头,所以存在这种形式的getHeaderField。 该连接类型的类应当重载此方法并缩短解析的过程。

Parameters:
name - the name of the header field. 头字段的名称。
Default - the default value. 默认值。
Returns:
the value of the named field, parsed as an integer. The Default value is returned if the field is missing or malformed. 解析为数字的指定名称字段的值。如果字段缺失返回默认值。

<!-- -->

getHeaderFieldDate

public long getHeaderFieldDate(Stringname,
                               longDefault)
Returns the value of the named field parsed as date. The result is the number of milliseconds since January 1, 1970 GMT represented by the named field. 返回解析为时间的指定名称的字段值。结果为指定名称字段表示的从GMT1970年1月1日起的毫秒数。

This form of getHeaderField exists because some connection types (e.g., http-ng) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing. 因为一些连接类型(比如http-ng)已预解析头,所以存在这种形式的getHeaderField。 该连接类型的类应当重载此方法并缩短解析的过程。

Parameters:
name - the name of the header field. 头字段的名称。
Default - a default value. 默认值。
Returns:
the value of the field, parsed as a date. The value of the Default argument is returned if the field is missing or malformed. 解析为日期的字段值。如果字段缺失返回默认值。

<!-- -->

getHeaderFieldKey

public String getHeaderFieldKey(intn)
Returns the key for the nth header field. It returns null if there are fewer than n+1 fields. 返回nth头字段的键值。如果字段数小于n+1,返回null。

Parameters:
n - an index, where n>=0 索引,大于等于0
Returns:
the key for the nth header field, or null if there are fewer than n+1 fields. nth头字段的键值,如果字段数小于n+1,返回null。

<!-- -->

getHeaderField

public String getHeaderField(intn)
Returns the value for the nth header field. It returns null if there are fewer than n+1fields. 返回nth头字段的值。如果字段数小于n+1,返回null。

This method can be used in conjunction with the getHeaderFieldKey method to iterate through all the headers in the message. 该方法可以和getHeaderFieldKey方法联合使用以遍历信息中的所有头。

Parameters:
n - an index, where n>=0 索引,大于等于0
Returns:
the value of the nth header field or null if there are fewer than n+1 fields nth头字段的值,如果字段数小于n+1,返回null。
See Also:
getHeaderFieldKey(int)

<!-- -->

getContent

public Object

  


  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics