Top Inners Fields Constructors Methods
org.jboss.modules

pack-priv final Class DataURLStreamHandler

extends URLStreamHandler
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.net.ProtocolException, .URL, .URLConnection, .URLDecoder, .URLStreamHandler, java.nio.charset.Charset, .StandardCharsets, .UnsupportedCharsetException, java.util.Base64

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final DataURLStreamHandler

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static DataURLStreamHandler
protected URLConnection
openConnection(final URL
the URL that this connects to.
url
)

Implements abstract java.net.URLStreamHandler.openConnection.

Opens a connection to the object referenced by the URL argument.
Inherited from java.net.URLStreamHandler:
equalsgetDefaultPortgetHostAddresshashCodehostsEqualopenConnectionparseURLsameFilesetURLsetURLtoExternalForm

Field Detail

INSTANCEback to summary
private static final DataURLStreamHandler INSTANCE

Constructor Detail

DataURLStreamHandlerback to summary
private DataURLStreamHandler()

Method Detail

getInstanceback to summary
pack-priv static DataURLStreamHandler getInstance()
openConnectionback to summary
protected URLConnection openConnection(final URL url) throws IOException

Implements abstract java.net.URLStreamHandler.openConnection.

Doc from java.net.URLStreamHandler.openConnection.

Opens a connection to the object referenced by the URL argument. This method should be overridden by a subclass.

If for the handler's protocol (such as HTTP or JAR), there exists a public, specialized URLConnection subclass belonging to one of the following packages or one of their subpackages: java.lang, java.io, java.util, java.net, the connection returned will be of that subclass. For example, for HTTP an HttpURLConnection will be returned, and for JAR a JarURLConnection will be returned.

Parameters
url:URL

the URL that this connects to.

Returns:URLConnection

a URLConnection object for the URL.

Exceptions
IOException:
if an I/O error occurs while opening the connection.
org.jboss.modules back to summary

pack-priv final Class DataURLStreamHandler.DataURLConnection

extends URLConnection
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final byte[]
private final String
private final String
private static final int
private static final int
private static final int
private static final int
private static final int
Inherited from java.net.URLConnection:
allowUserInteractionconnecteddoInputdoOutputifModifiedSinceurluseCaches

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
connect()

Implements abstract java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
public Object
getContent()

Overrides java.net.URLConnection.getContent.

Retrieves the contents of this URL connection.
public int
getContentLength()

Overrides java.net.URLConnection.getContentLength.

Returns the value of the content-length header field.
public String
getContentType()

Overrides java.net.URLConnection.getContentType.

Returns the value of the content-type header field.
public InputStream
getInputStream()

Overrides java.net.URLConnection.getInputStream.

Returns an input stream that reads from this open connection.
private static ProtocolException
invalidChar(int pos)

private static boolean
isCTToken(int cp)

Inherited from java.net.URLConnection:
addRequestPropertygetAllowUserInteractiongetConnectTimeoutgetContentgetContentEncodinggetContentLengthLonggetDategetDefaultAllowUserInteractiongetDefaultRequestPropertygetDefaultUseCachesgetDefaultUseCachesgetDoInputgetDoOutputgetExpirationgetFileNameMapgetHeaderFieldgetHeaderFieldgetHeaderFieldDategetHeaderFieldIntgetHeaderFieldKeygetHeaderFieldLonggetHeaderFieldsgetIfModifiedSincegetLastModifiedgetOutputStreamgetPermissiongetReadTimeoutgetRequestPropertiesgetRequestPropertygetURLgetUseCachesguessContentTypeFromNameguessContentTypeFromStreamsetAllowUserInteractionsetConnectTimeoutsetContentHandlerFactorysetDefaultAllowUserInteractionsetDefaultRequestPropertysetDefaultUseCachessetDefaultUseCachessetDoInputsetDoOutputsetFileNameMapsetIfModifiedSincesetReadTimeoutsetRequestPropertysetUseCachestoString

Field Detail

contentback to summary
private final byte[] content
contentStringback to summary
private final String contentString
contentTypeback to summary
private final String contentType
ST_INITIALback to summary
private static final int ST_INITIAL
ST_PARAMETERback to summary
private static final int ST_PARAMETER
ST_PARAMETER_VALback to summary
private static final int ST_PARAMETER_VAL
ST_SUBTYPEback to summary
private static final int ST_SUBTYPE
ST_TYPEback to summary
private static final int ST_TYPE

Constructor Detail

DataURLConnectionback to summary
pack-priv DataURLConnection(final URL url) throws IOException

Method Detail

connectback to summary
public void connect()

Implements abstract java.net.URLConnection.connect.

Doc from java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored.

URLConnection objects go through two phases: first they are created, then they are connected. After being created, and before being connected, various options can be specified (e.g., doInput and UseCaches). After connecting, it is an error to try to set them. Operations that depend on being connected, like getContentLength, will implicitly perform the connection, if necessary.

getContentback to summary
public Object getContent()

Overrides java.net.URLConnection.getContent.

Doc from java.net.URLConnection.getContent.

Retrieves the contents of this URL connection.

This method first determines the content type of the object by calling the getContentType method. If this is the first time that the application has seen that specific content type, a content handler for that content type is created.

This is done as follows:

  1. If the application has set up a content handler factory instance using the setContentHandlerFactory method, the createContentHandler method of that instance is called with the content type as an argument; the result is a content handler for that content type.
  2. If no ContentHandlerFactory has yet been set up, or if the factory's createContentHandler method returns null, then the ServiceLoader mechanism is used to locate ContentHandlerFactory implementations using the system class loader. The order that factories are located is implementation specific, and an implementation is free to cache the located factories. A ServiceConfigurationError, Error or RuntimeException thrown from the createContentHandler, if encountered, will be propagated to the calling thread. The createContentHandler method of each factory, if instantiated, is invoked, with the content type, until a factory returns non-null, or all factories have been exhausted.
  3. Failing that, this method tries to load a content handler class as defined by ContentHandler. If the class does not exist, or is not a subclass of ContentHandler, then an UnknownServiceException is thrown.
Returns:Object

the object fetched. The instanceof operator should be used to determine the specific kind of object returned.

getContentLengthback to summary
public int getContentLength()

Overrides java.net.URLConnection.getContentLength.

Doc from java.net.URLConnection.getContentLength.

Returns the value of the content-length header field.

Note

getContentLengthLong() should be preferred over this method, since it returns a long instead and is therefore more portable.

Returns:int

the content length of the resource that this connection's URL references, -1 if the content length is not known, or if the content length is greater than Integer.MAX_VALUE.

getContentTypeback to summary
public String getContentType()

Overrides java.net.URLConnection.getContentType.

Doc from java.net.URLConnection.getContentType.

Returns the value of the content-type header field.

Returns:String

the content type of the resource that the URL references, or null if not known.

getInputStreamback to summary
public InputStream getInputStream()

Overrides java.net.URLConnection.getInputStream.

Doc from java.net.URLConnection.getInputStream.

Returns an input stream that reads from this open connection. A SocketTimeoutException can be thrown when reading from the returned input stream if the read timeout expires before data is available for read.

Returns:InputStream

an input stream that reads from this open connection.

invalidCharback to summary
private static ProtocolException invalidChar(int pos)
isCTTokenback to summary
private static boolean isCTToken(int cp)