Package org.drools.io

Class 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
    • 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:
        writeExternal in interface java.io.Externalizable
        Overrides:
        writeExternal in class BaseResource
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Overrides:
        readExternal in class BaseResource
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        This implementation opens an InputStream for the given class path resource.
        Specified by:
        getInputStream in interface org.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.IOException
        This implementation returns a URL for the underlying class path resource.
        Specified by:
        getURL in interface InternalResource
        Throws:
        java.io.IOException
        See Also:
        ClassLoader.getResource(String), Class.getResource(String)
      • getReader

        public java.io.Reader getReader()
                                 throws java.io.IOException
        Specified by:
        getReader in interface org.kie.api.io.Resource
        Throws:
        java.io.IOException
      • listResources

        public java.util.Collection<org.kie.api.io.Resource> listResources()
        Specified by:
        listResources in interface InternalResource
      • getClazz

        public java.lang.Class<?> getClazz()
      • getPath

        public java.lang.String getPath()
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class BaseResource