Package org.jmxtrans.agent.util.io
Class ClasspathResource
java.lang.Object
org.jmxtrans.agent.util.io.AbstractResource
org.jmxtrans.agent.util.io.ClasspathResource
- All Implemented Interfaces:
Resource
public class ClasspathResource extends AbstractResource implements Resource
Resource for classpath:// path.- Author:
- Cyrille Le Clerc
-
Constructor Summary
Constructors Constructor Description ClasspathResource(String path) -
Method Summary
Modifier and Type Method Description booleanexists()This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.StringgetDescription()Return a description for this resource, to be used for error output when working with the resource.FilegetFile()Return a File handle for this resource.InputStreamgetInputStream()Return anInputStream.URLgetURL()Return a URL handle for this resource.Methods inherited from class org.jmxtrans.agent.util.io.AbstractResource
getURI, lastModified, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jmxtrans.agent.util.io.Resource
getURI, lastModified
-
Constructor Details
-
ClasspathResource
-
-
Method Details
-
exists
public boolean exists()Description copied from class:AbstractResourceThis implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. This will cover both directories and content resources.- Specified by:
existsin interfaceResource- Overrides:
existsin classAbstractResource
-
getURL
Description copied from interface:ResourceReturn a URL handle for this resource.- Specified by:
getURLin interfaceResource- Overrides:
getURLin classAbstractResource
-
getFile
Description copied from interface:ResourceReturn a File handle for this resource.- Specified by:
getFilein interfaceResource- Overrides:
getFilein classAbstractResource
-
getInputStream
Description copied from interface:ResourceReturn anInputStream.It is expected that each call creates a fresh stream.
- Specified by:
getInputStreamin interfaceResource- Returns:
- the input stream for the underlying resource (must not be
null)
-
getDescription
Description copied from interface:ResourceReturn a description for this resource, to be used for error output when working with the resource.Implementations are also encouraged to return this value from their
toStringmethod.- Specified by:
getDescriptionin interfaceResource- See Also:
Object.toString()
-