org.carrot2.util.resource
Class URLResource

java.lang.Object
  extended by org.carrot2.util.resource.URLResource
All Implemented Interfaces:
IResource
Direct Known Subclasses:
ClassResource

public class URLResource
extends Object
implements IResource

This class opens a connection to a resource pointed to by an URI. Note that JAR resources should not be accessed this way because the default handler caches JarFile instances and thus locks the file. This resource provider caches the content of returned resources and closes the underlying stream handle in open().

See Also:
Issue CARROT-143

Constructor Summary
URLResource(URL url)
           
 
Method Summary
 boolean equals(Object obj)
           
 URL getUrl()
           
 int hashCode()
           
 InputStream open()
          Open an input stream to the resource.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLResource

public URLResource(URL url)
Method Detail

open

public InputStream open()
                 throws IOException
Description copied from interface: IResource
Open an input stream to the resource. Specific implementations may cache and close the underlying stream, but such behavior is not required by this interface. Please refer to the documentation of specific implementations for details.

Specified by:
open in interface IResource
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

getUrl

public URL getUrl()


Copyright (c) Dawid Weiss, Stanislaw Osinski