All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.swirlds.common.io.ExternalSelfSerializable Maven / Gradle / Ivy

Go to download

Swirlds is a software platform designed to build fully-distributed applications that harness the power of the cloud without servers. Now you can develop applications with fairness in decision making, speed, trust and reliability, at a fraction of the cost of traditional server-based platforms.

There is a newer version: 0.56.6
Show newest version
/*
 * Copyright (C) 2020-2024 Hedera Hashgraph, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.swirlds.common.io;

import com.swirlds.common.io.streams.SerializableDataInputStream;
import com.swirlds.common.io.streams.SerializableDataOutputStream;
import java.io.IOException;
import java.nio.file.Path;

/**
 * 

* An object that can serialize itself to a stream and a directory on a file system. */ public interface ExternalSelfSerializable extends SerializableDet { /** * Serialize data both to the stream and to a directory. The data serialized to the stream * must be sufficient for {@link #deserialize(SerializableDataInputStream, Path, int)} * to fully reconstruct the object. Any data written to disk MUST be written to a file that * is contained by the provided directory. * * @param out * the stream to write to * @param outputDirectory * a location on disk where data can be written. When saving state, this is * the same directory that holds the signed state file. * @throws IOException * thrown in case of an IO exception */ void serialize(SerializableDataOutputStream out, Path outputDirectory) throws IOException; /** * Reconstruct this object using the data serialized by * {@link #serialize(SerializableDataOutputStream, Path)}. * This method may load additional data from the provided directory. * * @param in * The input stream. * @param inputDirectory * a location on disk where data can be read. Corresponds to the directory passed to * {@link #serialize(SerializableDataOutputStream, Path)}. When reading a saved state, * this is the same directory that holds the signed state file. * @param version * The version at which this object was serialized. Guaranteed to be greater or equal to the * minimum version and less than or equal to the current version. * @throws IOException * thrown in case of an IO exception */ void deserialize(SerializableDataInputStream in, Path inputDirectory, int version) throws IOException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy