001/*
002 * The contents of this file are subject to the license and copyright detailed
003 * in the LICENSE and NOTICE files at the root of the source tree.
004 */
005package org.duraspace.bagit;
006
007import java.io.IOException;
008import java.nio.file.Path;
009
010/**
011 * Interface for common deserialization operations for {@link gov.loc.repository.bagit.domain.Bag}s. Each deserializer
012 * is instantiated independently of what it is working on so that only {@link BagDeserializer#deserialize(Path)}
013 * needs to be called.
014 *
015 * @author mikejritter
016 * @since 2020-02-11
017 */
018public interface BagDeserializer {
019
020    /**
021     * Deserialize a {@link gov.loc.repository.bagit.domain.Bag} located at the given {@code path}. This will create a
022     * version of the bag in the parent directory of the given {@code path}.
023     *
024     * @param path the {@link Path} to the serialized version of a {@link gov.loc.repository.bagit.domain.Bag}
025     * @return the {@link Path} to the deserialized bag
026     * @throws IOException if there are any errors deserializing the bag
027     */
028    Path deserialize(final Path path) throws IOException;
029
030}