Package org.drools.core.io.impl
Class ClassPathResource
- java.lang.Object
-
- org.drools.core.io.impl.BaseResource
-
- org.drools.core.io.impl.ClassPathResource
-
- All Implemented Interfaces:
Externalizable
,Serializable
,InternalResource
,org.kie.api.io.Resource
public class ClassPathResource extends BaseResource implements InternalResource, Externalizable
Borrowed gratuitously from Spring under ASL2.0. +- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.drools.core.io.impl.BaseResource
bytes
-
-
Constructor Summary
Constructors Constructor Description ClassPathResource()
ClassPathResource(String path)
ClassPathResource(String path, Class<?> clazz)
ClassPathResource(String path, ClassLoader classLoader)
ClassPathResource(String path, String encoding)
ClassPathResource(String path, String encoding, Class<?> clazz)
ClassPathResource(String path, String encoding, Class<?> clazz, ClassLoader classLoader)
ClassPathResource(String path, String encoding, ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
ClassLoader
getClassLoader()
Class<?>
getClazz()
String
getEncoding()
InputStream
getInputStream()
This implementation opens an InputStream for the given class path resource.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.kie.api.io.Resource>
listResources()
void
readExternal(ObjectInput in)
void
setClassLoader(ClassLoader classLoader)
String
toString()
void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.drools.core.io.impl.BaseResource
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, getSourcePath, getTargetPath, setCategories, setConfiguration, setDescription, setResourceType, setSourcePath, setTargetPath
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.io.internal.InternalResource
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, setCategories, setConfiguration, setDescription, setResourceType
-
-
-
-
Constructor Detail
-
ClassPathResource
public ClassPathResource()
-
ClassPathResource
public ClassPathResource(String path)
-
ClassPathResource
public ClassPathResource(String path, ClassLoader classLoader)
-
ClassPathResource
public ClassPathResource(String path, String encoding, ClassLoader classLoader)
-
ClassPathResource
public ClassPathResource(String path, String encoding, Class<?> clazz, ClassLoader classLoader)
-
-
Method Detail
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classBaseResource
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classBaseResource
- Throws:
IOException
ClassNotFoundException
-
getInputStream
public InputStream getInputStream() throws IOException
This implementation opens an InputStream for the given class path resource.- Specified by:
getInputStream
in interfaceorg.kie.api.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 interfaceInternalResource
- Throws:
IOException
- See Also:
ClassLoader.getResource(String)
,Class.getResource(String)
-
hasURL
public boolean hasURL()
- Specified by:
hasURL
in interfaceInternalResource
-
getEncoding
public String getEncoding()
- Specified by:
getEncoding
in interfaceInternalResource
-
getReader
public Reader getReader() throws IOException
- Specified by:
getReader
in interfaceorg.kie.api.io.Resource
- Throws:
IOException
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectory
in interfaceInternalResource
-
listResources
public Collection<org.kie.api.io.Resource> listResources()
- Specified by:
listResources
in interfaceInternalResource
-
getClassLoader
public ClassLoader getClassLoader()
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
-
getClazz
public Class<?> getClazz()
-
getPath
public String getPath()
-
equals
public boolean equals(Object object)
- Overrides:
equals
in classBaseResource
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBaseResource
-
toString
public String toString()
- Overrides:
toString
in classBaseResource
-
-