Package org.kie.internal.io

# Class ResourceFactory

java.lang.Object
org.kie.internal.io.ResourceFactory

public class ResourceFactory extends Object

Convenience Factory to provide Resource implementations for the desired IO resource.

     KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
     kbuilder.add( ResourceFactory.newUrlResource( "htp://www.domain.org/myProcess.bpmn2" ),
                   ResourceType.BPMN2 );

     KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
     kbuilder.add( ResourceFactory.newClassPathResource( "htp://www.domain.org/myrules.drl", getClass() ),
                   ResourceType.DRL );

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourceFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Resource`
  `newByteArrayResource(byte[] bytes)`
  `static Resource`
  `newClassPathResource(String path)`
  `static Resource`
  `newClassPathResource(String path, Class clazz)`
  `static Resource`
  `newClassPathResource(String path, ClassLoader classLoader)`
  `static Resource`
  `newClassPathResource(String path, String encoding)`
  `static Resource`
  `newClassPathResource(String path, String encoding, Class clazz)`
  `static Resource`
  `newClassPathResource(String path, String encoding, ClassLoader classLoader)`
  `static Resource`
  `newDescrResource(KnowledgeDescr descr)`
  `static Resource`
  `newFileResource(File file)`
  `static Resource`
  `newFileResource(String fileName)`
  `static Resource`
  `newInputStreamResource(InputStream stream)`
  `static Resource`
  `newInputStreamResource(InputStream stream, String encoding)`
  `static Resource`
  `newReaderResource(Reader reader)`
  `static Resource`
  `newReaderResource(Reader reader, String encoding)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ResourceFactory

    public ResourceFactory()

- ## Method Details

  - ### newFileResource

    public static Resource newFileResource(File file)

  - ### newFileResource

    public static Resource newFileResource(String fileName)

  - ### newByteArrayResource

    public static Resource newByteArrayResource(byte[] bytes)

  - ### newInputStreamResource

    public static Resource newInputStreamResource(InputStream stream)

  - ### newInputStreamResource

    public static Resource newInputStreamResource(InputStream stream, String encoding)

  - ### newReaderResource

    public static Resource newReaderResource(Reader reader)

  - ### newReaderResource

    public static Resource newReaderResource(Reader reader, String encoding)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path, Class clazz)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path, ClassLoader classLoader)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path, String encoding)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path, String encoding, Class clazz)

  - ### newClassPathResource

    public static Resource newClassPathResource(String path, String encoding, ClassLoader classLoader)

  - ### newDescrResource

    public static Resource newDescrResource(KnowledgeDescr descr)