Package htsjdk.beta.io.bundle
Class BundleJSON
java.lang.Object
htsjdk.beta.io.bundle.BundleJSON
Methods for serializing and deserializing Bundles to and from JSON strings.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
BUNDLE_EXTENSION
- See Also:
-
JSON_PROPERTY_SCHEMA_NAME
- See Also:
-
JSON_PROPERTY_SCHEMA_VERSION
- See Also:
-
JSON_PROPERTY_PRIMARY
- See Also:
-
JSON_PROPERTY_PATH
- See Also:
-
JSON_PROPERTY_FORMAT
- See Also:
-
JSON_SCHEMA_NAME
- See Also:
-
JSON_SCHEMA_VERSION
- See Also:
-
-
Constructor Details
-
BundleJSON
public BundleJSON()
-
-
Method Details
-
toJSON
Serialize this bundle to a JSON string representation. All resources in the bundle must beIOPathResource
s for serialization to succeed. Stream resources cannot be serialized.- Parameters:
bundle
- theBundle
to serialize to JSON- Returns:
- a JSON string representation of this bundle
- Throws:
IllegalArgumentException
- if any resource in bundle is not an IOPathResources.
-
toBundle
Create a Bundle from jsonString.- Parameters:
jsonString
- a valid JSON string conforming to the bundle schema- Returns:
- a
Bundle
created from jsonString
-
toBundle
public static <T extends IOPath> Bundle toBundle(String jsonString, Function<String, T> ioPathConstructor) Create a Bundle from jsonString using a custom class that implementsIOPath
for all resources.- Type Parameters:
T
- the IOPath-derived type to use for IOPathResources- Parameters:
jsonString
- a valid JSON string conforming to the bundle schemaioPathConstructor
- a function that takes a string and returns an IOPath-derived class of type- Returns:
- a newly created
Bundle
-