001package io.cui.tools.io; 002 003import java.io.IOException; 004import java.io.OutputStream; 005import java.io.Serializable; 006 007/** 008 * Interface for file writer operations. 009 * 010 * @author Sven Haag 011 */ 012public interface FileWriter extends Serializable { 013 014 /** 015 * 016 * @return true if an actual file is writable. 017 */ 018 boolean isWritable(); 019 020 /** 021 * @return the filename in an appropriate presentation. 022 */ 023 StructuredFilename getFileName(); 024 025 /** 026 * @return an {@link OutputStream} on the corresponding file. It implicitly checks 027 * {@link #isWritable()} before accessing the file and will throw an 028 * {@link IllegalStateException} in case it is not readable. 029 * @throws IOException 030 */ 031 OutputStream outputStream() throws IOException; 032}