public class URLConnections extends Object
| 构造器和说明 |
|---|
URLConnections() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getContentEncoding(URLConnection conn)
Returns the value of the
content-encoding header field. |
static int |
getContentLength(URLConnection conn)
Returns the value of the
content-length header field. |
static long |
getContentLengthLong(URLConnection conn)
Returns the value of the
content-length header field as a
long. |
static String |
getContentType(URLConnection conn)
Returns the value of the
content-type header field. |
static long |
getDate(URLConnection conn)
Returns the value of the
date header field. |
static long |
getExpiration(URLConnection conn)
Returns the value of the
expires header field. |
static String |
getHeaderField(URLConnection conn,
String name) |
static long |
getHeaderFieldDate(URLConnection conn,
String name,
long defaultValue) |
static int |
getHeaderFieldInt(URLConnection conn,
String name,
int defaultValue) |
static long |
getHeaderFieldLong(URLConnection conn,
String name,
long defaultValue) |
static long |
getLastModified(URLConnection conn)
Returns the value of the
last-modified header field. |
public static long getHeaderFieldLong(URLConnection conn, String name, long defaultValue)
public static int getHeaderFieldInt(URLConnection conn, String name, int defaultValue)
public static long getHeaderFieldDate(URLConnection conn, String name, long defaultValue)
public static int getContentLength(URLConnection conn)
content-length header field.
Note: getContentLengthLong()
should be preferred over this method, since it returns a long
instead and is therefore more portable.
-1 if the content length is not known,
or if the content length is greater than Integer.MAX_VALUE.public static long getContentLengthLong(URLConnection conn)
content-length header field as a
long.-1 if the content length is
not known.public static String getContentType(URLConnection conn)
content-type header field.null if not known.URLConnection.getHeaderField(String)public static String getContentEncoding(URLConnection conn)
content-encoding header field.null if not known.URLConnection.getHeaderField(String)public static long getExpiration(URLConnection conn)
expires header field.URLConnection.getHeaderField(String)public static long getDate(URLConnection conn)
date header field.0 if not known. The value returned is the
number of milliseconds since January 1, 1970 GMT.URLConnection.getHeaderField(String)public static long getLastModified(URLConnection conn)
last-modified header field.
The result is the number of milliseconds since January 1, 1970 GMT.URLConnection was last modified, or 0 if not known.URLConnection.getHeaderField(String)public static String getHeaderField(URLConnection conn, String name)
Copyright © 2020. All rights reserved.