Class UrlResourceStream
- java.lang.Object
-
- org.apache.wicket.util.resource.AbstractResourceStream
-
- org.apache.wicket.core.util.resource.UrlResourceStream
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,org.apache.wicket.util.io.IClusterable
,org.apache.wicket.util.resource.IFixedLocationResourceStream
,org.apache.wicket.util.resource.IResourceStream
,org.apache.wicket.util.watch.IModifiable
public class UrlResourceStream extends org.apache.wicket.util.resource.AbstractResourceStream implements org.apache.wicket.util.resource.IFixedLocationResourceStream
UrlResourceStream implements IResource for URLs.- Author:
- Jonathan Locke, Igor Vaynberg
- See Also:
IResourceStream
,IModifiable
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UrlResourceStream(URL url)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this resource.String
getContentType()
InputStream
getInputStream()
URL
getURL()
Instant
lastModifiedTime()
org.apache.wicket.util.lang.Bytes
length()
String
locationAsString()
String
toString()
-
-
-
Constructor Detail
-
UrlResourceStream
public UrlResourceStream(URL url)
Construct.- Parameters:
url
- URL of resource
-
-
Method Detail
-
close
public void close() throws IOException
Closes this resource.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Throws:
IOException
-
getInputStream
public InputStream getInputStream() throws org.apache.wicket.util.resource.ResourceStreamNotFoundException
- Specified by:
getInputStream
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Returns:
- A readable input stream for this resource.
- Throws:
org.apache.wicket.util.resource.ResourceStreamNotFoundException
-
getURL
public URL getURL()
- Returns:
- The URL to this resource (if any)
-
lastModifiedTime
public Instant lastModifiedTime()
- Specified by:
lastModifiedTime
in interfaceorg.apache.wicket.util.watch.IModifiable
- Overrides:
lastModifiedTime
in classorg.apache.wicket.util.resource.AbstractResourceStream
- Returns:
- The last time this resource was modified
- See Also:
IModifiable.lastModifiedTime()
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
getContentType
in classorg.apache.wicket.util.resource.AbstractResourceStream
- Returns:
- The content type of this resource, such as "image/jpeg" or "text/html"
-
length
public org.apache.wicket.util.lang.Bytes length()
- Specified by:
length
in interfaceorg.apache.wicket.util.resource.IResourceStream
- Overrides:
length
in classorg.apache.wicket.util.resource.AbstractResourceStream
-
locationAsString
public String locationAsString()
- Specified by:
locationAsString
in interfaceorg.apache.wicket.util.resource.IFixedLocationResourceStream
-
-