Package org.jmxtrans.agent.util.io
Class FileResource
java.lang.Object
org.jmxtrans.agent.util.io.AbstractResource
org.jmxtrans.agent.util.io.FileResource
- All Implemented Interfaces:
Resource
public class FileResource extends AbstractResource implements Resource
Resource for path/to/file.txt resources.- Author:
- Cyrille Le Clerc
-
Constructor Summary
Constructors Constructor Description FileResource(File file)FileResource(String filePath) -
Method Summary
Modifier and Type Method Description 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.URIgetURI()Return a URI handle for this resource.URLgetURL()Return a URL handle for this resource.Methods inherited from class org.jmxtrans.agent.util.io.AbstractResource
exists, 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
exists, lastModified
-
Constructor Details
-
FileResource
-
FileResource
-
-
Method Details
-
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)
-
getURL
Description copied from interface:ResourceReturn a URL handle for this resource.- Specified by:
getURLin interfaceResource- Overrides:
getURLin classAbstractResource
-
getURI
Description copied from interface:ResourceReturn a URI handle for this resource.- Specified by:
getURIin interfaceResource- Overrides:
getURIin classAbstractResource
-
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()
-