UrlAsset
final class UrlAsset
Extends: Asset
Package: dev.joid.lib.asset.impl · Module: core · Source: UrlAsset.java
An asset read from a URL, over the network or from a file:, jar: or other scheme.
Description
Section titled “Description”A String that starts with a scheme (https:, file:, jar:) gives one; its id is the URL.
A connection waits 10 seconds to connect and 30 seconds for data; an https: URL that fails on a TLS error is tried once more over http:, and any other error goes up as it is.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
UrlAsset | of(String url) factory | Creates the asset of url. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
InputStream | open() | Connects to the URL and returns its content. |
File | getFile() | Returns the file of a file: URL, or null for any other URL or a file: URL that is not a valid file URI. |
boolean | isRemote() | If true, the URL is neither file: nor jar: and is read on a background thread. |
String | getUrl() | Returns the URL. |
Inherited from Asset (4)
peek · read · toString · getUniqueId
Creation details
Section titled “Creation details”UrlAsset of(String url) factory
Creates the asset of url.
Method details
Section titled “Method details”InputStream open()
Connects to the URL and returns its content.
Throws IOException when the connection or the transfer fails; for the http: retry, its failure is added as suppressed to the TLS error.
getFile
Section titled “getFile”File getFile()
Returns the file of a file: URL, or null for any other URL or a file: URL that is not a valid file URI.
isRemote
Section titled “isRemote”boolean isRemote()
If true, the URL is neither file: nor jar: and is read on a background thread.
getUrl
Section titled “getUrl”String getUrl()
Returns the URL.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
