public class ODS
extends java.lang.Object
This class also contains overall settings for ODS.
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
ignoreInvalidCustomTags |
| Modifier and Type | Method and Description |
|---|---|
static void |
allowUndefinedTags(boolean value)
Informs ods whether or not to thrown an error when it comes across an undefined custom tag.
|
static <T> T |
deserialize(Tag<?> tag,
java.lang.Class<T> mainClazz)
Deserialize back into an object
|
static Compressor |
getCompressor(java.lang.String name)
Get the compressor registered with a name.
|
static java.lang.String |
getCompressorName(Compressor compressor)
Get the name of a compressor.
|
static java.util.List<Tag<?>> |
getCustomTags()
Get the list of custom tags.
|
static void |
registerCompression(java.lang.String name,
Compressor compressor)
Add a custom compression type by name.
|
static void |
registerCustomTag(Tag<?> tag)
Register a custom tag into the system.
|
static ObjectTag |
serialize(java.lang.String key,
java.lang.Object obj)
Serialize an object.
|
static <T> T |
unwrap(Tag<T> tag)
Unwrap a tag and turn it back into it's original value.
|
static <T> java.util.List<T> |
unwrapList(java.util.List<Tag<T>> tags)
Unwrap a list full of tags.
|
static <T> java.util.List<T> |
unwrapListTag(ListTag<? extends Tag<T>> list)
Unwrap a ListTag into a list.
|
static <T> java.util.List<Tag<?>> |
wrap(java.util.List<T> list)
Wrap all of the objects inside of the list.
|
static Tag<?> |
wrap(java.lang.Object o)
Wrap an object to a tag.
|
static <T> ListTag<?> |
wrap(java.lang.String name,
java.util.List<T> list)
Wrap a list into a list tag.
|
static Tag<?> |
wrap(java.lang.String name,
java.lang.Object o)
Wrap an object to a tag.
|
public static Tag<?> wrap(java.lang.Object o)
The name is not set by this method.
This method cannot wrap Lists, Maps. Objects are automatically serialized.
o - The object to wrap.public static Tag<?> wrap(java.lang.String name, java.lang.Object o)
This method cannot wrap Lists, Maps. Objects are automatically serialized.
name - The name of the tag to wrap.o - The object to wrap.public static <T> T unwrap(Tag<T> tag)
This method will not work for Lists, Maps, and Objects.
T - The data type of the tag.tag - The tag to unwrap.public static <T> ListTag<?> wrap(java.lang.String name, java.util.List<T> list)
T - The data type of the list.name - The name of the list tag.list - The list to turn into a list tag.
The list can only contain objects that can be converted into tags. The contents of the list are automatically wrapped. Note: This list cannot contain Objects, Lists, or Maps.
public static <T> java.util.List<Tag<?>> wrap(java.util.List<T> list)
The same limitations apply as with the wrap(Object) method.
T - The data type of the list.list - The list to wrap.public static <T> java.util.List<T> unwrapList(java.util.List<Tag<T>> tags)
This method is not for unwrapping the LinkList to a normal list.
T - The data type of the tags.
The list must be a uniform data type.
tags - The list of tags.public static <T> java.util.List<T> unwrapListTag(ListTag<? extends Tag<T>> list)
T - The data type of the list.list - The ListTag to convert back into a list.
The contents of the list are automatically unwrapped.
public static ObjectTag serialize(java.lang.String key, java.lang.Object obj)
key - The keyobj - The objectpublic static <T> T deserialize(Tag<?> tag, java.lang.Class<T> mainClazz)
T - The deserialized class.tag - The tag.mainClazz - The main class.public static void registerCustomTag(Tag<?> tag)
tag - The tag class to add.public static void registerCompression(java.lang.String name,
Compressor compressor)
This exists so objects that rely on compression, like the CompressedObjectTag, are able
to be cross language. So if you have a ZSTD compressed object made in C# you can still read it in Java by registering
a Compressor with the same name.
name - The name.compressor - The compressor.public static Compressor getCompressor(java.lang.String name)
name - The name of the compressor.public static java.lang.String getCompressorName(Compressor compressor)
compressor - The compressor.public static java.util.List<Tag<?>> getCustomTags()
public static void allowUndefinedTags(boolean value)
Only enable this when developing something like a visualizer program.
value - Whether or not to thrown an error when it comes across an undefined custom tag.