Package org.htmlunit.protocol.data
Class DataURLConnection
- java.lang.Object
-
- java.net.URLConnection
-
- org.htmlunit.protocol.data.DataURLConnection
-
public class DataURLConnection extends java.net.URLConnection
A URLConnection for supporting data URLs.- See Also:
- RFC2397
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATA_PREFIX
The "URL" prefix 'data:'.private DataUrlDecoder
dataUrlDecoder_
-
Constructor Summary
Constructors Constructor Description DataURLConnection(java.net.URL url)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
This method does nothing in this implementation but is required to be implemented.java.lang.String
getCharset()
Gets the charset information specified in the data URL.java.io.InputStream
getInputStream()
Returns the input stream - in this case the content of the URL.java.lang.String
getMediaType()
Gets the media type information contained in the data URL.-
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
-
-
Field Detail
-
DATA_PREFIX
public static final java.lang.String DATA_PREFIX
The "URL" prefix 'data:'.- See Also:
- Constant Field Values
-
dataUrlDecoder_
private final DataUrlDecoder dataUrlDecoder_
-
-
Method Detail
-
connect
public void connect()
This method does nothing in this implementation but is required to be implemented.- Specified by:
connect
in classjava.net.URLConnection
-
getInputStream
public java.io.InputStream getInputStream()
Returns the input stream - in this case the content of the URL.- Overrides:
getInputStream
in classjava.net.URLConnection
- Returns:
- the input stream
-
getCharset
public java.lang.String getCharset()
Gets the charset information specified in the data URL.- Returns:
- "US-ASCII" if the URL didn't contain any charset information
-
getMediaType
public java.lang.String getMediaType()
Gets the media type information contained in the data URL.- Returns:
- "text/plain" if the URL didn't contain any media type information
-
-