java.lang.Object
org.apache.wicket.util.resource.AbstractResourceStream
org.apache.wicket.util.resource.FileResourceStream
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,IClusterable,IFixedLocationResourceStream,IResourceStream,IModifiable
public class FileResourceStream
extends AbstractResourceStream
implements IFixedLocationResourceStream
A FileResourceStream is an IResource implementation for files.
- Author:
- Jonathan Locke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFileResourceStream(File file) Constructor.FileResourceStream(File file) Constructor. -
Method Summary
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
-
Constructor Details
-
Method Details
-
close
Closes this resource.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIResourceStream- Throws:
IOException
-
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
-
getFile
- Returns:
- The file this resource resides in, if any.
-
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:
- A readable input stream for this resource. The same input stream is returned until FileResourceStream.close() is invoked.
- 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 time this resource was modified
- See Also:
-
toString
-
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
-
locationAsString
- Specified by:
locationAsStringin interfaceIFixedLocationResourceStream- Returns:
- The fixed location as a string, e.g. the file name or the URL. Return null to avoid caching the markup.
-