Package org.jmxtrans.agent.util.io
Class UrlResource
java.lang.Object
org.jmxtrans.agent.util.io.AbstractResource
org.jmxtrans.agent.util.io.UrlResource
- All Implemented Interfaces:
Resource
public class UrlResource extends AbstractResource implements Resource
- Author:
- Cyrille Le Clerc
-
Field Summary
-
Constructor Summary
Constructors Constructor Description UrlResource(String url) -
Method Summary
Modifier and Type Method Description protected voidconfigureUrlConnection(URLConnection conn)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.longlastModified()Determine the last-modified timestamp for this resource.Methods inherited from class org.jmxtrans.agent.util.io.AbstractResource
getURI, getURL, toString
-
Field Details
-
logger
-
-
Constructor Details
-
UrlResource
-
-
Method Details
-
getFile
Description copied from interface:ResourceReturn a File handle for this resource.- Specified by:
getFilein interfaceResource- Overrides:
getFilein classAbstractResource
-
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
-
lastModified
public long lastModified()Description copied from interface:ResourceDetermine the last-modified timestamp for this resource.- Specified by:
lastModifiedin interfaceResource- Overrides:
lastModifiedin classAbstractResource
-
configureUrlConnection
-
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()
-