/*
 * Copyright (c) 2002-2010 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 *  the terms of the license agreement you entered into with JSCAPE.
 */

package com.jscape.util.io;

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

/**
 * @author Alex Usun
 */
public class PropertiesCodec
        implements DataCodec<Properties> {

    public static Properties readValue(InputStream in)
            throws IOException {
        Properties properties = new Properties();
        properties.load(in);

        return properties;
    }

    public static void writeValue(Properties value, OutputStream out)
            throws IOException {
        value.store(out, "");
    }

    public Properties read(InputStream in)
            throws IOException {
        return readValue(in);
    }

    public void write(Properties value, OutputStream out)
            throws IOException {
        writeValue(value, out);
    }
}
