Package org.htmlunit.protocol.data
Class DataURLConnection
java.lang.Object
java.net.URLConnection
org.htmlunit.protocol.data.DataURLConnection
A URLConnection for supporting data URLs.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The "URL" prefix 'data:'.private final DataUrlDecoder
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
This method does nothing in this implementation but is required to be implemented.Gets the charset information specified in the data URL.Returns the input stream - in this case the content of the URL.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 Details
-
DATA_PREFIX
The "URL" prefix 'data:'.- See Also:
-
dataUrlDecoder_
-
-
Constructor Details
-
DataURLConnection
Creates an instance.- Parameters:
url
- the data URL- Throws:
UnsupportedEncodingException
- in case the encoding is not supported
-
-
Method Details
-
connect
public void connect()This method does nothing in this implementation but is required to be implemented.- Specified by:
connect
in classURLConnection
-
getInputStream
Returns the input stream - in this case the content of the URL.- Overrides:
getInputStream
in classURLConnection
- Returns:
- the input stream
-
getCharset
Gets the charset information specified in the data URL.- Returns:
- "US-ASCII" if the URL didn't contain any charset information
-
getMediaType
Gets the media type information contained in the data URL.- Returns:
- "text/plain" if the URL didn't contain any media type information
-