org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim

## Class KryoShimServiceLoader

- java.lang.Object
- - org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.KryoShimServiceLoader

-     public class KryoShimServiceLoader
      extends Object

  Loads the highest-priority or user-selected `KryoShimService`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `KRYO_SHIM_SERVICE` Set this system property to the fully-qualified name of a `KryoShimService` package-and-classname to force it into service.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KryoShimServiceLoader()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `applyConfiguration(Configuration conf)`
    `static KryoShimService` | `load()` Equivalent to `load(boolean)` with the parameter `true`.
    `static KryoShimService` | `load(boolean forceReload)` Return a reference to the shim service.
    `static <T> T` | `readClassAndObject(InputStream source)` A loose abstraction of `org.apache.tinkerpop.shaded.kryo.Kryo#readClassAndObject(Input)`, where the `input` parameter is `source`.
    `static byte[]` | `writeClassAndObjectToBytes(Object o)` A loose abstraction of `org.apache.tinkerpop.shaded.kryo.Kryo#writeClassAndObject(Output, Object)`, where the `output` parameter is an internally-created `ByteArrayOutputStream`.

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

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

- - ### Field Detail

    - #### KRYO_SHIM_SERVICE

          public static final String KRYO_SHIM_SERVICE

      Set this system property to the fully-qualified name of a `KryoShimService` package-and-classname to force it into service. Setting this property causes the priority-selection mechanism (`KryoShimService.getPriority()`) to be ignored.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### KryoShimServiceLoader

          public KryoShimServiceLoader()

  - ### Method Detail

    - #### applyConfiguration

          public static void applyConfiguration(Configuration conf)

    - #### load

          public static KryoShimService load(boolean forceReload)

      Return a reference to the shim service. This method may return a cached shim service unless `forceReload` is true. Calls to this method need not be externally synchonized.
      Parameters:
        `forceReload` - if false, this method may use its internal service cache; if true, this method must ignore cache, and it must invoke `ServiceLoader.reload()` before selecting a new service to return
      Returns:
        the shim service

    - #### load

          public static KryoShimService load()

      Equivalent to `load(boolean)` with the parameter `true`.
      Returns:
        the (possibly cached) shim service

    - #### writeClassAndObjectToBytes

          public static byte[] writeClassAndObjectToBytes(Object o)

      A loose abstraction of `org.apache.tinkerpop.shaded.kryo.Kryo#writeClassAndObject(Output, Object)`, where the `output` parameter is an internally-created `ByteArrayOutputStream`. Returns the byte array underlying that stream.
      Parameters:
        `o` - an object for which the instance and class are serialized
      Returns:
        the serialized form

    - #### readClassAndObject

          public static <T> T readClassAndObject(InputStream source)

      A loose abstraction of `org.apache.tinkerpop.shaded.kryo.Kryo#readClassAndObject(Input)`, where the `input` parameter is `source`. Returns the deserialized object.
      Type Parameters:
        `T` - the type to which the deserialized object is cast as it is returned
      Parameters:
        `source` - an input stream containing data for a serialized object class and instance
      Returns:
        the deserialized object

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.