org.apache.jmeter.save

## Class SaveService

- java.lang.Object
- - org.apache.jmeter.save.SaveService

-     public class SaveService
      extends java.lang.Object

  Handles setting up XStream serialisation. The class reads alias definitions from saveservice.properties.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `RESULTCOLLECTOR_HELPER_OBJECT`
    `static java.lang.String` | `SAMPLE_EVENT_OBJECT`
    `static java.lang.String` | `TEST_CLASS_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SaveService()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `aliasToClass(java.lang.String s)`
    `static java.lang.String` | `CEtoString(com.thoughtworks.xstream.converters.ConversionException ce)` Simplify getMessage() output from XStream ConversionException
    `static java.lang.String` | `classToAlias(java.lang.String s)`
    `static java.lang.String` | `getFileEncoding(java.lang.String dflt)` Returns the file Encoding specified in saveservice.properties or the default
    `static java.lang.String` | `getPropertiesVersion()`
    `static java.lang.String` | `getVERSION()`
    `static java.lang.Object` | `loadElement(java.io.InputStream in)`
    `static java.util.Properties` | `loadProperties()`
    `static void` | `loadTestResults(java.io.InputStream reader, ResultCollectorHelper resultCollectorHelper)` Read results from JTL file.
    `static HashTree` | `loadTree(java.io.File file)` Load a Test tree (JMX file)
    `static void` | `saveElement(java.lang.Object el, java.io.OutputStream out)`
    `static void` | `saveSampleResult(SampleEvent evt, java.io.Writer writer)` Save a sampleResult to an XML output file using XStream.
    `static void` | `saveTree(HashTree tree, java.io.OutputStream out)`

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

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

- - ### Field Detail

    - #### SAMPLE_EVENT_OBJECT

          public static final java.lang.String SAMPLE_EVENT_OBJECT

      See Also:
        Constant Field Values

    - #### RESULTCOLLECTOR_HELPER_OBJECT

          public static final java.lang.String RESULTCOLLECTOR_HELPER_OBJECT

      See Also:
        Constant Field Values

    - #### TEST_CLASS_NAME

          public static final java.lang.String TEST_CLASS_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SaveService

          public SaveService()

  - ### Method Detail

    - #### loadProperties

          public static java.util.Properties loadProperties()
                                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### aliasToClass

          public static java.lang.String aliasToClass(java.lang.String s)

    - #### classToAlias

          public static java.lang.String classToAlias(java.lang.String s)

    - #### saveTree

          public static void saveTree(HashTree tree,
                                      java.io.OutputStream out)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### saveElement

          public static void saveElement(java.lang.Object el,
                                         java.io.OutputStream out)
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### loadElement

          public static java.lang.Object loadElement(java.io.InputStream in)
                                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### saveSampleResult

          public static void saveSampleResult(SampleEvent evt,
                                              java.io.Writer writer)
                                       throws java.io.IOException

      Save a sampleResult to an XML output file using XStream.
      Parameters:
        `evt` - sampleResult wrapped in a sampleEvent
        `writer` - output stream which must be created using `getFileEncoding(String)`
      Throws:
        `java.io.IOException` - when writing data to output fails

    - #### loadTestResults

          public static void loadTestResults(java.io.InputStream reader,
                                             ResultCollectorHelper resultCollectorHelper)
                                      throws java.io.IOException

      Read results from JTL file.
      Parameters:
        `reader` - of the file
        `resultCollectorHelper` - helper class to enable TestResultWrapperConverter to deliver the samples
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### loadTree

          public static HashTree loadTree(java.io.File file)
                                   throws java.io.IOException

      Load a Test tree (JMX file)
      Parameters:
        `file` - the JMX file
      Returns:
        the loaded tree
      Throws:
        `java.io.IOException` - if there is a problem reading the file or processing it

    - #### getFileEncoding

          public static java.lang.String getFileEncoding(java.lang.String dflt)

      Returns the file Encoding specified in saveservice.properties or the default
      Parameters:
        `dflt` - value to return if file encoding was not provided
      Returns:
        file encoding or default

    - #### CEtoString

          public static java.lang.String CEtoString(com.thoughtworks.xstream.converters.ConversionException ce)

      Simplify getMessage() output from XStream ConversionException
      Parameters:
        `ce` - - ConversionException to analyse
      Returns:
        string with details of error

    - #### getPropertiesVersion

          public static java.lang.String getPropertiesVersion()

    - #### getVERSION

          public static java.lang.String getVERSION()

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.