Package org.drools.io
Class ClassPathResource
- java.lang.Object
-
- org.drools.io.BaseResource
-
- org.drools.io.ClassPathResource
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,InternalResource,org.kie.api.io.Resource
public class ClassPathResource extends BaseResource implements InternalResource, java.io.Externalizable
Borrowed gratuitously from Spring under ASL2.0. +- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.drools.io.BaseResource
bytes
-
-
Constructor Summary
Constructors Constructor Description ClassPathResource()ClassPathResource(java.lang.String path)ClassPathResource(java.lang.String path, java.lang.Class<?> clazz)ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader)ClassPathResource(java.lang.String path, java.lang.String encoding)ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.Class<?> clazz)ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.Class<?> clazz, java.lang.ClassLoader classLoader)ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.ClassLoader classLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)java.lang.Class<?>getClazz()java.lang.StringgetEncoding()java.io.InputStreamgetInputStream()This implementation opens an InputStream for the given class path resource.java.lang.StringgetPath()java.io.ReadergetReader()java.net.URLgetURL()This implementation returns a URL for the underlying class path resource.inthashCode()booleanhasURL()booleanisDirectory()java.util.Collection<org.kie.api.io.Resource>listResources()voidreadExternal(java.io.ObjectInput in)java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class org.drools.io.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.io.InternalResource
addCategory, getBytes, getCategories, getConfiguration, getDescription, getResourceType, setCategories, setConfiguration, setDescription, setResourceType
-
-
-
-
Constructor Detail
-
ClassPathResource
public ClassPathResource()
-
ClassPathResource
public ClassPathResource(java.lang.String path)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.Class<?> clazz)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.String encoding)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.Class<?> clazz)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.ClassLoader classLoader)
-
ClassPathResource
public ClassPathResource(java.lang.String path, java.lang.String encoding, java.lang.Class<?> clazz, java.lang.ClassLoader classLoader)
-
-
Method Detail
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classBaseResource- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classBaseResource- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionThis implementation opens an InputStream for the given class path resource.- Specified by:
getInputStreamin interfaceorg.kie.api.io.Resource- Throws:
java.io.IOException- See Also:
ClassLoader.getResourceAsStream(String),Class.getResourceAsStream(String)
-
getURL
public java.net.URL getURL() throws java.io.IOExceptionThis implementation returns a URL for the underlying class path resource.- Specified by:
getURLin interfaceInternalResource- Throws:
java.io.IOException- See Also:
ClassLoader.getResource(String),Class.getResource(String)
-
hasURL
public boolean hasURL()
- Specified by:
hasURLin interfaceInternalResource
-
getEncoding
public java.lang.String getEncoding()
- Specified by:
getEncodingin interfaceInternalResource
-
getReader
public java.io.Reader getReader() throws java.io.IOException- Specified by:
getReaderin interfaceorg.kie.api.io.Resource- Throws:
java.io.IOException
-
isDirectory
public boolean isDirectory()
- Specified by:
isDirectoryin interfaceInternalResource
-
listResources
public java.util.Collection<org.kie.api.io.Resource> listResources()
- Specified by:
listResourcesin interfaceInternalResource
-
getClazz
public java.lang.Class<?> getClazz()
-
getPath
public java.lang.String getPath()
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classBaseResource
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBaseResource
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseResource
-
-