Class URLResource

java.lang.Object
org.cryptacular.io.URLResource
All Implemented Interfaces:
Resource

public class URLResource extends Object implements Resource
Describes a (presumably remote) resource accessible via URL.
Author:
Middleware Services
  • Constructor Details

    • URLResource

      public URLResource(URL url)
      Creates a new URL resource.
      Parameters:
      url - Non-null URL where resource is located.
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: Resource
      Gets an input stream around the resource. Callers of this method are responsible for resource cleanup; it should be sufficient to simply call InputStream.close() unless otherwise noted.

      Implementers should produce a new instance on every call to this method to provide for thread-safe usage patterns on a shared resource.

      Specified by:
      getInputStream in interface Resource
      Returns:
      Input stream around underlying resource, e.g. file, remote resource (URI), etc.
      Throws:
      IOException - On IO errors.
    • toString

      public String toString()
      Overrides:
      toString in class Object