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:
java.io.Closeable,java.io.Serializable,java.lang.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:
IResourceStream,IModifiable, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FileSystemResourceStream(java.io.File file)Constructor.FileSystemResourceStream(java.nio.file.Path path)Constructor.FileSystemResourceStream(File file)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the resource.java.lang.StringgetContentType()Gets the mime type of this resourcejava.io.InputStreamgetInputStream()Gets the resource stream.java.nio.file.PathgetPath()TimelastModifiedTime()Gets the last time this modifiable thing changed.Byteslength()Gets the size of this resourcejava.lang.StringlocationAsString()java.lang.StringtoString()-
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
-
-
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws ResourceStreamNotFoundExceptionDescription 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:
IResourceStream.close()
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:IResourceStreamCloses the resource. Normally, this includes closing any underlying input stream returned by getInputStream().- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceIResourceStream- Throws:
java.io.IOException
-
getContentType
public java.lang.String 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
-
getPath
public final java.nio.file.Path getPath()
- Returns:
- The path this resource resides in, if any.
-
lastModifiedTime
public Time 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
-
length
public Bytes 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
public java.lang.String 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-