org.kie.api.io

## Interface Resource

- All Superinterfaces:
    Serializable

      public interface Resource
      extends Serializable

  Generic interface to provide a Reader or InputStream for the underlying IO resource.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ResourceConfiguration` | `getConfiguration()` Returns the configuration for the resource if one is available.
    `InputStream` | `getInputStream()` Open an InputStream to the resource, the user must close this when finished.
    `Reader` | `getReader()` Opens a Reader to the resource, the user must close this when finished.
    `ResourceType` | `getResourceType()` Returns the type of the resource if one could be inferred by the extension of the resource or if it was explicitly set.
    `String` | `getSourcePath()` Returns the name of the resource, if one is available.
    `String` | `getTargetPath()` Returns the path that should be used when writing this resource down to KieFileSystem.
    `Resource` | `setConfiguration(ResourceConfiguration conf)` Sets the resource configuration in case it is necessary.
    `Resource` | `setResourceType(ResourceType type)` Sets the resource type.
    `Resource` | `setSourcePath(String path)` Sets this resource name.
    `Resource` | `setTargetPath(String path)` In case this resource should be written to a different path when writing it down to the KieFileSystem, this property allows the application to set such path.

- - ### Method Detail

    - #### getInputStream

          InputStream getInputStream()
                                     throws IOException

      Open an InputStream to the resource, the user must close this when finished.
      Returns:
      Throws:
        `IOException`

    - #### getReader

          Reader getReader()
                           throws IOException

      Opens a Reader to the resource, the user must close this when finished.
      Returns:
      Throws:
        `IOException`

    - #### getSourcePath

          String getSourcePath()

      Returns the name of the resource, if one is available.

    - #### getTargetPath

          String getTargetPath()

      Returns the path that should be used when writing this resource down to KieFileSystem.

    - #### getResourceType

          ResourceType getResourceType()

      Returns the type of the resource if one could be inferred by the extension of the resource or if it was explicitly set.

    - #### getConfiguration

          ResourceConfiguration getConfiguration()

      Returns the configuration for the resource if one is available.

    - #### setSourcePath

          Resource setSourcePath(String path)

      Sets this resource name. Some services require a resource to be named and it is not always possible to infer a name automatically. For instance, a file resource automatically infers its name from the file and path, but a byte array resource has to be given a name.
      Parameters:
        `path` - the path of the resource
      Returns:
        the resource itself in order to use it as a fluent API

    - #### setTargetPath

          Resource setTargetPath(String path)

      In case this resource should be written to a different path when writing it down to the KieFileSystem, this property allows the application to set such path.
      Parameters:
        `path` - the path of the resource
      Returns:
        the resource itself in order to use it as a fluent API

    - #### setResourceType

          Resource setResourceType(ResourceType type)

      Sets the resource type. For some resources it is possible to infer the type by the file name extension for instance. When it is not possible to infer it automatically, the user is expected to set it.
      Parameters:
        `type` - the resource type
      Returns:
        the resource itself in order to use it as a fluent API

    - #### setConfiguration

          Resource setConfiguration(ResourceConfiguration conf)

      Sets the resource configuration in case it is necessary.
      Parameters:
        `conf` - the resource configuration
      Returns:
        the resource itself in order to use it as a fluent API

Copyright © 2001–2015 JBoss by Red Hat. All rights reserved.