Class 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_  
      • Fields inherited from class java.net.URLConnection

        allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DATA_PREFIX

        public static final java.lang.String DATA_PREFIX
        The "URL" prefix 'data:'.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DataURLConnection

        public DataURLConnection​(java.net.URL url)
                          throws java.io.UnsupportedEncodingException
        Creates an instance.
        Parameters:
        url - the data URL
        Throws:
        java.io.UnsupportedEncodingException - in case the encoding is not supported
    • Method Detail

      • connect

        public void connect()
        This method does nothing in this implementation but is required to be implemented.
        Specified by:
        connect in class java.net.URLConnection
      • getInputStream

        public java.io.InputStream getInputStream()
        Returns the input stream - in this case the content of the URL.
        Overrides:
        getInputStream in class java.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