类 Headers
java.lang.Object
com.lark.oapi.okhttp.Headers
The header fields of a single HTTP message. Values are uninterpreted strings; use
Request
and Response for interpreted headers. This class maintains the order of the header fields
within the HTTP message.
This class tracks header values line-by-line. A field with multiple comma- separated values on the same line will be treated as a field with a single value by this class. It is the caller's responsibility to detect and split on commas if their field permits multiple values. This simplifies use of single-valued fields whose values routinely contain commas, such as cookies or dates.
This class trims whitespace from values. It never returns values with leading or trailing whitespace.
Instances of this class are immutable. Use Headers.Builder to create instances.
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明longReturns the number of bytes required to encode these headers using HTTP/1.1.booleanReturns true ifotheris aHeadersobject with the same headers, with the same casing, in the same order.Returns the last value corresponding to the specified field, or null.Returns the last value corresponding to the specified field parsed as an HTTP date, or null if either the field is absent or cannot be parsed as a date.getInstant(String name) Returns the last value corresponding to the specified field parsed as an HTTP date, or null if either the field is absent or cannot be parsed as a date.inthashCode()name(int index) Returns the field atposition.names()Returns an immutable case-insensitive set of header names.static HeadersReturns headers for the alternating header names and values.static HeadersReturns headers for the header names and values in theMap.intsize()Returns the number of field values.toString()value(int index) Returns the value atindex.Returns an immutable list of the header values forname.
-
方法详细资料
-
of
Returns headers for the alternating header names and values. There must be an even number of arguments, and they must alternate between header names and values. -
of
Returns headers for the header names and values in theMap. -
get
Returns the last value corresponding to the specified field, or null. -
getDate
Returns the last value corresponding to the specified field parsed as an HTTP date, or null if either the field is absent or cannot be parsed as a date. -
getInstant
Returns the last value corresponding to the specified field parsed as an HTTP date, or null if either the field is absent or cannot be parsed as a date. -
size
public int size()Returns the number of field values. -
name
Returns the field atposition. -
value
Returns the value atindex. -
names
Returns an immutable case-insensitive set of header names. -
values
Returns an immutable list of the header values forname. -
byteCount
public long byteCount()Returns the number of bytes required to encode these headers using HTTP/1.1. This is also the approximate size of HTTP/2 headers before they are compressed with HPACK. This value is intended to be used as a metric: smaller headers are more efficient to encode and transmit. -
newBuilder
-
equals
Returns true ifotheris aHeadersobject with the same headers, with the same casing, in the same order. Note that two headers instances may be semantically equal but not equal according to this method. In particular, none of the following sets of headers are equal according to this method:1. Original Content-Type: text/html Content-Length: 50 2. Different order Content-Length: 50 Content-Type: text/html 3. Different case content-type: text/html content-length: 50 4. Different values Content-Type: text/html Content-Length: 050Applications that require semantically equal headers should convert them into a canonical form before comparing them for equality.
-
hashCode
public int hashCode() -
toString
-
toMultimap
-