Module org.apache.wicket.util
Package org.apache.wicket.util.resource
Class AbstractStringResourceStream
java.lang.Object
org.apache.wicket.util.resource.AbstractResourceStream
org.apache.wicket.util.resource.AbstractStringResourceStream
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,IClusterable,IResourceStream,IStringResourceStream,IModifiable
- Direct Known Subclasses:
StringBufferResourceStream,StringResourceStream
public abstract class AbstractStringResourceStream
extends AbstractResourceStream
implements IStringResourceStream
Base class for string resources.
- Author:
- Jonathan Locke
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe content-type applied in case the resource stream's default constructor is used -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()voidclose()Closes the resource.protected CharsetGets the mime type of this resourceGets the resource stream.protected abstract StringGets the last time this modifiable thing changed.final Byteslength()Gets the size of this resourcevoidsetCharset(Charset charset) Sets the character set used for reading this resource.voidsetLastModified(Instant lastModified) Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
getLocale, getStyle, getVariation, setLocale, setStyle, setVariationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.wicket.util.resource.IResourceStream
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
-
Field Details
-
DEFAULT_CONTENT_TYPE
The content-type applied in case the resource stream's default constructor is used- See Also:
-
-
Constructor Details
-
AbstractStringResourceStream
public AbstractStringResourceStream()Constructor. -
AbstractStringResourceStream
Constructor.- Parameters:
contentType- The mime type of this resource, such as "image/jpeg" or "text/html"
-
-
Method Details
-
asString
- Specified by:
asStringin interfaceIStringResourceStream- Returns:
- This resource as a String.
-
getCharset
- Returns:
- Charset for resource
-
setCharset
Sets the character set used for reading this resource.- Specified by:
setCharsetin interfaceIStringResourceStream- Parameters:
charset- Charset for component
-
close
Description copied from interface:IResourceStreamCloses the resource. Normally, this includes closing any underlying input stream returned by getInputStream().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIResourceStream- Throws:
IOException- See Also:
-
getContentType
Description copied from interface:IResourceStreamGets the mime type of this resource- Specified by:
getContentTypein interfaceIResourceStream- Overrides:
getContentTypein classAbstractResourceStream- Returns:
- The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestHandler handle the Content-Type automatically
- See Also:
-
getInputStream
Description copied from interface:IResourceStreamGets the resource stream. You should not directly close this stream. Instead call the close() method on IResourceStream.- Specified by:
getInputStreamin interfaceIResourceStream- Returns:
- Returns the inputStream.
- Throws:
ResourceStreamNotFoundException- See Also:
-
lastModifiedTime
Description copied from interface:IModifiableGets the last time this modifiable thing changed.- Specified by:
lastModifiedTimein interfaceIModifiable- Overrides:
lastModifiedTimein classAbstractResourceStream- Returns:
- the last modification
Timeornullif that information is not available - See Also:
-
setLastModified
- Parameters:
lastModified- The lastModified to set.
-
getString
- Returns:
- The string resource
-
length
Description copied from interface:IResourceStreamGets the size of this resource- Specified by:
lengthin interfaceIResourceStream- Overrides:
lengthin classAbstractResourceStream- Returns:
- The size of this resource in the number of bytes, or
nullif unknown
-