/* Copyright (c) 2001, Oracle Corporation. All rights reserved. */
package oracle.portal.provider.v2.preference;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Interface for data objects stored in a {@link PreferenceStore}. Classes
 * implementing this interface are expected to have a public zero argument
 * constructor.
 */
public interface PreferenceDataObject
{

    /**
     * Sets the version associated with the content of the
     * PreferenceDataObject. The version number is a String to allow you to
     * define the structure of your version numbers.
     *
     * @param version version string to be associated with the content of the
     * PreferenceDataObject
     */
    public void setContentVersion(String version);

    /**
     * Gets the version String associated with the content of the
     * PreferenceDataObject
     *
     * @return the version String associated with the content of the
     * PreferenceDataObject
     */
    public String getContentVersion();

    /**
     * Populates the PreferenceDataObject with content read from a
     * persistent store
     *
     * @param is InputStream from which content should be read
     */
    public void read(InputStream is) throws IOException;

    /**
     * Writes the content of the PreferenceDataObject to a persistent store
     *
     * @param os OutputStream to which content should be written
     */
    public void write(OutputStream os) throws IOException;

}

