Package com.io7m.waxmill.serializer.api
Interface WXMSerializerProviderType<T>
- Type Parameters:
T- The type of serialized values
- All Known Subinterfaces:
WXMBootConfigurationsSerializerProviderType,WXMClientConfigurationSerializerProviderType,WXMVirtualMachineSerializerProviderType
- All Known Implementing Classes:
WXMBootConfigurationsSerializers,WXMClientConfigurationSerializers,WXMVirtualMachineSerializers
public interface WXMSerializerProviderType<T>
The type of serializer providers.
-
Method Summary
Modifier and Type Method Description WXMSerializerTypecreate(java.net.URI uri, java.io.OutputStream stream, T value)Create a new serializer.default voidserialize(java.nio.file.Path output, java.nio.file.Path outputTmp, T value)A convenience method to serialize data to a file.
-
Method Details
-
create
WXMSerializerType create(java.net.URI uri, java.io.OutputStream stream, T value) throws java.io.IOExceptionCreate a new serializer.- Parameters:
uri- The URI of the outputstream- The output streamvalue- The value to serialize- Returns:
- A new serializer
- Throws:
java.io.IOException- On I/O errors
-
serialize
default void serialize(java.nio.file.Path output, java.nio.file.Path outputTmp, T value) throws java.io.IOExceptionA convenience method to serialize data to a file. The output is written to the given temporary file and then atomically renamed to the given output path. This prevents any external processes from seeing half-written data. The given paths should both refer to the same underlying filesystem, as operating systems typically have this restriction when atomically renaming files.- Parameters:
output- The output pathoutputTmp- The temporary output pathvalue- The value to serialize- Throws:
java.io.IOException- On I/O errors
-