Class URLLuteceResource

java.lang.Object
fr.paris.lutece.plugins.resource.loader.URLLuteceResource
All Implemented Interfaces:
LuteceResource

public class URLLuteceResource extends Object implements LuteceResource
Implementation of LuteceResource for URL's.
  • Constructor Details

    • URLLuteceResource

      public URLLuteceResource(URL url)
  • Method Details

    • getFile

      public File getFile()
      Description copied from interface: LuteceResource

      Returns the resource as a file, if possible. A resource doesn't need to be available as a file: If you require a file, use ResourceManager.getResourceAsFile(LuteceResource).

      Specified by:
      getFile in interface LuteceResource
      Returns:
      A File containing the resources contents, if available, or null.
    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: LuteceResource

      Returns the resource as an InputStream. In general, you should not assume, that this method may me called more than once. In typical cases (for example, if the Resource is backed by a file or loaded through the classpath), one may create an InputStream as often as is necessary. However, you should think of cases like an URL pointing to a servlet, where the resource contents change with every call.

      If you need a reliable way of reloading the resource more than once, then you should use ResourceManager.getResourceAsFile(LuteceResource).

      Specified by:
      getInputStream in interface LuteceResource
      Returns:
      An InputStream with the resources contents, never null.
      Throws:
      IOException
    • getName

      public String getName()
      Description copied from interface: LuteceResource
      Returns the resources name, if possible. A resources name is a relatively unspecified thing. For example, if the resource has an URL, the name might be created by invoking URL.toExternalForm(). In the case of a File, it might be File.getPath().
      Specified by:
      getName in interface LuteceResource
    • getURI

      public URI getURI()
      Description copied from interface: LuteceResource

      Returns the resources URI, if possible. A resource doesn't need to have an URI.

      Specified by:
      getURI in interface LuteceResource
      Returns:
      The resources URI, if available, or null.
    • getURL

      public URL getURL()
      Description copied from interface: LuteceResource

      Returns the resources URL, if possible. A resource doesn't need to have an URL.

      Specified by:
      getURL in interface LuteceResource
      Returns:
      The resources URL, if available, or null.