Class StorageHelper

java.lang.Object
io.bdeploy.bhive.util.StorageHelper

public class StorageHelper extends Object
Provides functionality to persist and load model objects from persistent storage.

Methods are required to produce reproducible results per object.

ATTENTION: The underlying implementation may NOT be changed without exact knowledge of the impact. The objects may be hashed and stored in an object database, which means that changing the algorithm will basically break any hive which used the existing algorithm.

  • Constructor Details

    • StorageHelper

      public StorageHelper()
  • Method Details

    • toRawBytes

      public static byte[] toRawBytes(Object o)
      Serializes any in-memory Object to a stable storage-friendly byte[].
    • toRawYamlBytes

      public static byte[] toRawYamlBytes(Object o)
      Serializes any in-memory Object to a stable storage-friendly YAML style byte[].
    • fromRawBytes

      public static <T> T fromRawBytes(byte[] bytes, Class<T> clazz)
      De-serializes an Object of given type from a byte[].
    • fromPath

      public static <T> T fromPath(Path path, Class<T> clazz)
      De-serializes an Object of given type from a given file
    • fromStream

      public static <T> T fromStream(InputStream is, Class<T> clazz)
      De-serializes an Object of given type from a stream into memory.
    • fromYamlStream

      public static <T> T fromYamlStream(InputStream is, Class<T> clazz)
      De-serializes an Object of given type from a YAML content stream into memory.