Package cloud.piranha.resource
Class JarResource
- java.lang.Object
-
- cloud.piranha.resource.JarResource
-
- All Implemented Interfaces:
Resource
public class JarResource extends Object implements Resource
The default JarResource.- Author:
- Manfred Riem ([email protected])
-
-
Constructor Summary
Constructors Constructor Description JarResource()
Constructor.JarResource(File jarFile)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<String>
getAllLocations()
File
getJarFile()
Get the JAR file.URL
getResource(String location)
Get the resource.InputStream
getResourceAsStream(String location)
Get the resource as a stream.void
setJarFile(File jarFile)
Set the JAR file.
-
-
-
Constructor Detail
-
JarResource
public JarResource()
Constructor.
-
JarResource
public JarResource(File jarFile)
Constructor.- Parameters:
jarFile
- the JAR file.
-
-
Method Detail
-
getResource
public URL getResource(String location)
Description copied from interface:Resource
Get the resource.- Specified by:
getResource
in interfaceResource
- Parameters:
location
- the location.- Returns:
- the URL.
-
getResourceAsStream
public InputStream getResourceAsStream(String location)
Get the resource as a stream.Note that this method will read the content of a JAR entry into a byte-array to avoid locking the JAR file.
- Specified by:
getResourceAsStream
in interfaceResource
- Parameters:
location
- the resource location.- Returns:
- the input stream, or null if not found.
- See Also:
Resource.getResourceAsStream(java.lang.String)
-
getAllLocations
public Stream<String> getAllLocations()
- Specified by:
getAllLocations
in interfaceResource
-
getJarFile
public File getJarFile()
Get the JAR file.- Returns:
- the JAR file.
-
setJarFile
public void setJarFile(File jarFile)
Set the JAR file.- Parameters:
jarFile
- the JAR file.
-
-