Module org.apache.wicket.util
Package org.apache.wicket.util.resource
Class FileSystemResourceStream
java.lang.Object
org.apache.wicket.util.resource.AbstractResourceStream
org.apache.wicket.util.resource.FileSystemResourceStream
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,IClusterable
,IFixedLocationResourceStream
,IResourceStream
,IModifiable
public class FileSystemResourceStream
extends AbstractResourceStream
implements IFixedLocationResourceStream
A FileSystemResourceStream is an IResourceStream implementation for Java NIO paths.
- Author:
- Tobias Soloschenko
- See Also:
-
Constructor Summary
ConstructorDescriptionFileSystemResourceStream
(File file) Constructor.FileSystemResourceStream
(Path path) Constructor.FileSystemResourceStream
(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
-
getInputStream
Description copied from interface:IResourceStream
Gets the resource stream. You should not directly close this stream. Instead call the close() method on IResourceStream.- Specified by:
getInputStream
in interfaceIResourceStream
- Returns:
- Returns the inputStream.
- Throws:
ResourceStreamNotFoundException
- See Also:
-
close
Description copied from interface:IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceIResourceStream
- Throws:
IOException
-
getContentType
Description copied from interface:IResourceStream
Gets the mime type of this resource- Specified by:
getContentType
in interfaceIResourceStream
- Overrides:
getContentType
in 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
-
getPath
- Returns:
- The path this resource resides in, if any.
-
lastModifiedTime
Description copied from interface:IModifiable
Gets the last time this modifiable thing changed.- Specified by:
lastModifiedTime
in interfaceIModifiable
- Overrides:
lastModifiedTime
in classAbstractResourceStream
- Returns:
- the last modification
Time
ornull
if that information is not available
-
length
Description copied from interface:IResourceStream
Gets the size of this resource- Specified by:
length
in interfaceIResourceStream
- Overrides:
length
in classAbstractResourceStream
- Returns:
- The size of this resource in the number of bytes, or
null
if unknown
-
locationAsString
- Specified by:
locationAsString
in interfaceIFixedLocationResourceStream
- Returns:
- The fixed location as a string, e.g. the file name or the URL. Return null to avoid caching the markup.
-
toString
-