org.drools.io.impl
Class ClassPathResource

java.lang.Object
  extended by org.drools.io.impl.BaseResource
      extended by org.drools.io.impl.ClassPathResource
All Implemented Interfaces:
Externalizable, Serializable, InternalResource, org.drools.io.Resource

public class ClassPathResource
extends BaseResource
implements InternalResource, Externalizable

Borrowed gratuitously from Spring under ASL2.0. +

See Also:
Serialized Form

Constructor Summary
ClassPathResource()
           
ClassPathResource(String path)
           
ClassPathResource(String path, Class<?> clazz)
           
ClassPathResource(String path, Class<?> clazz, ClassLoader classLoader)
           
ClassPathResource(String path, ClassLoader classLoader)
           
 
Method Summary
 boolean equals(Object object)
           
 ClassLoader getClassLoader()
           
 Class<?> getClazz()
           
 InputStream getInputStream()
          This implementation opens an InputStream for the given class path resource.
 long getLastModified()
           
 long getLastRead()
           
 String getPath()
           
 Reader getReader()
           
 URL getURL()
          This implementation returns a URL for the underlying class path resource.
 int hashCode()
           
 boolean hasURL()
           
 boolean isDirectory()
           
 Collection<org.drools.io.Resource> listResources()
           
 void readExternal(ObjectInput in)
           
 void setClassLoader(ClassLoader classLoader)
           
protected  void setLastRead(long lastRead)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.io.impl.BaseResource
getConfiguration, getDescription, getName, getResourceType, setConfiguration, setDescription, setName, setResourceType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.io.internal.InternalResource
getConfiguration, getDescription, getName, getResourceType, setConfiguration, setDescription, setName, setResourceType
 

Constructor Detail

ClassPathResource

public ClassPathResource()

ClassPathResource

public ClassPathResource(String path)

ClassPathResource

public ClassPathResource(String path,
                         Class<?> clazz)

ClassPathResource

public ClassPathResource(String path,
                         ClassLoader classLoader)

ClassPathResource

public ClassPathResource(String path,
                         Class<?> clazz,
                         ClassLoader classLoader)
Method Detail

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

getInputStream

public InputStream getInputStream()
                           throws IOException
This implementation opens an InputStream for the given class path resource.

Specified by:
getInputStream in interface org.drools.io.Resource
Throws:
IOException
See Also:
ClassLoader.getResourceAsStream(String), Class.getResourceAsStream(String)

getURL

public URL getURL()
           throws IOException
This implementation returns a URL for the underlying class path resource.

Specified by:
getURL in interface InternalResource
Throws:
IOException
See Also:
ClassLoader.getResource(String), Class.getResource(String)

hasURL

public boolean hasURL()
Specified by:
hasURL in interface InternalResource

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface InternalResource

getLastRead

public long getLastRead()
Specified by:
getLastRead in interface InternalResource

getReader

public Reader getReader()
                 throws IOException
Specified by:
getReader in interface org.drools.io.Resource
Throws:
IOException

isDirectory

public boolean isDirectory()
Specified by:
isDirectory in interface InternalResource

listResources

public Collection<org.drools.io.Resource> listResources()
Specified by:
listResources in interface InternalResource

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

getClazz

public Class<?> getClazz()

getPath

public String getPath()

setLastRead

protected void setLastRead(long lastRead)

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.