public class PackageResourceStream extends AbstractResourceStream
IResourceStream
that reads data from a resource in the classpath. It simply delegates
all operations to the IResourceStream
returned by the application's
IResourceStreamLocator
.Constructor and Description |
---|
PackageResourceStream(Class<?> scope,
String path)
Obtains an
IResourceStream from the application's
IResourceStreamLocator.locate(Class, String) |
PackageResourceStream(Class<?> scope,
String path,
Locale locale,
String style,
String variation)
Obtains an
IResourceStream from the application's
IResourceStreamLocator.locate(Class, String) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the resource.
|
String |
getContentType()
Gets the mime type of this resource
|
InputStream |
getInputStream()
Gets the resource stream.
|
Time |
lastModifiedTime()
Gets the last time this modifiable thing changed.
|
Bytes |
length()
Gets the size of this resource
|
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
public PackageResourceStream(Class<?> scope, String path)
IResourceStream
from the application's
IResourceStreamLocator.locate(Class, String)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in.path
- The path to the resourcepublic PackageResourceStream(Class<?> scope, String path, Locale locale, String style, String variation)
IResourceStream
from the application's
IResourceStreamLocator.locate(Class, String)
scope
- This argument will be used to get the class loader for loading the package
resource, and to determine what package it is in.path
- The path to the resourcelocale
- the locale of the resource to getstyle
- the style of the resource to getvariation
- the variation of the resource to getpublic void close() throws IOException
IResourceStream
IOException
public String getContentType()
IResourceStream
getContentType
in interface IResourceStream
getContentType
in class AbstractResourceStream
public InputStream getInputStream() throws ResourceStreamNotFoundException
IResourceStream
ResourceStreamNotFoundException
IResourceStream.close()
public Bytes length()
IResourceStream
length
in interface IResourceStream
length
in class AbstractResourceStream
null
if unknownpublic Time lastModifiedTime()
IModifiable
lastModifiedTime
in interface IModifiable
lastModifiedTime
in class AbstractResourceStream
Time
or
null
if that information is not availableCopyright © 2006–2022 Apache Software Foundation. All rights reserved.