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 StringThe "URL" prefix 'data:'.private final DataUrlDecoderFields inherited from class URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()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 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
-
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:
connectin classURLConnection
-
getInputStream
Returns the input stream - in this case the content of the URL.- Overrides:
getInputStreamin 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
-