Package org.apache.sysds.api.mlcontext

## Class ScriptFactory

- java.lang.Object
- - org.apache.sysds.api.mlcontext.ScriptFactory

-     public class ScriptFactory
      extends Object

  Factory for creating DML and PYDML Script objects from strings, files, URLs, and input streams.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ScriptFactory()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Script` | `dml​(String scriptString)` | Create a DML Script object based on a string.
    `static Script` | `dmlFromFile​(String scriptFilePath)` | Create a DML Script object based on a string path to a file.
    `static Script` | `dmlFromInputStream​(InputStream inputStream)` | Create a DML Script object based on an input stream.
    `static Script` | `dmlFromLocalFile​(File localScriptFile)` | Creates a DML Script object based on a file in the local file system.
    `static Script` | `dmlFromResource​(String resourcePath)` | Create a DML Script object based on a resource path.
    `static Script` | `dmlFromString​(String scriptString)` | Create a DML Script object based on a string.
    `static Script` | `dmlFromUrl​(String scriptUrlPath)` | Create a DML Script object based on a URL path.
    `static Script` | `dmlFromUrl​(URL scriptUrl)` | Create a DML Script object based on a URL.

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

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

- - ### Constructor Detail

    - #### ScriptFactory

          public ScriptFactory()

  - ### Method Detail

    - #### dmlFromFile

          public static Script dmlFromFile​(String scriptFilePath)

      Create a DML Script object based on a string path to a file.
      Parameters:
        `scriptFilePath` - path to DML script file (local or HDFS)
      Returns:
        DML Script object

    - #### dmlFromInputStream

          public static Script dmlFromInputStream​(InputStream inputStream)

      Create a DML Script object based on an input stream.
      Parameters:
        `inputStream` - input stream to DML
      Returns:
        DML Script object

    - #### dmlFromLocalFile

          public static Script dmlFromLocalFile​(File localScriptFile)

      Creates a DML Script object based on a file in the local file system. To create a DML Script object from a local file or HDFS, please use `dmlFromFile(String)`.
      Parameters:
        `localScriptFile` - the local DML file
      Returns:
        DML Script object

    - #### dmlFromString

          public static Script dmlFromString​(String scriptString)

      Create a DML Script object based on a string.
      Parameters:
        `scriptString` - string of DML
      Returns:
        DML Script object

    - #### dmlFromUrl

          public static Script dmlFromUrl​(String scriptUrlPath)

      Create a DML Script object based on a URL path.
      Parameters:
        `scriptUrlPath` - URL path to DML script
      Returns:
        DML Script object

    - #### dmlFromUrl

          public static Script dmlFromUrl​(URL scriptUrl)

      Create a DML Script object based on a URL.
      Parameters:
        `scriptUrl` - URL to DML script
      Returns:
        DML Script object

    - #### dmlFromResource

          public static Script dmlFromResource​(String resourcePath)

      Create a DML Script object based on a resource path.
      Parameters:
        `resourcePath` - path to a resource on the classpath
      Returns:
        DML Script object

    - #### dml

          public static Script dml​(String scriptString)

      Create a DML Script object based on a string.
      Parameters:
        `scriptString` - string of DML
      Returns:
        DML Script object