package com.avg.zaap.crashlibrary.offline.publisher.metadata;

import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * This interface denotes the common behavior for the crash metadata writer dependency factories.
 * <p/>
 * Created by marek.osvald on 28.7.2016.
 */
public interface ICrashMetadataWriterFactory {

    /**
     * Returns an instance of crash metadata helper.
     *
     * @return an instance of crash metadata helper
     */
    ICrashMetadataHelper getCrashMetadataHelper();

    /**
     * Returns a file instance for given directory and filename.
     *
     * @param directory parent directory
     * @param fileName  file name
     * @return file instance for given directory and filename
     */
    File openFile(File directory, String fileName);

    /**
     * Returns an instance of output stream writer for given given file.
     *
     * @param file file to retrieve the writer for
     * @return an instance of output stream writer for given given file
     * @throws IOException when file does not exist
     */
    OutputStreamWriter getFileWriter(File file) throws IOException;

}
