001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.doxia.sink; 020 021import java.io.File; 022import java.io.IOException; 023import java.io.OutputStream; 024 025/** 026 * A factory that creates a <code>Sink</code> object. 027 * 028 * @author <a href="kenney@apache.org">Kenney Westerhof</a> 029 * @since 1.0-alpha-9 030 */ 031public interface SinkFactory { 032 033 /** 034 * Create a <code>Sink</code> into a file. 035 * 036 * @param outputDir the not-null output dir. 037 * @param outputName the not-null output name. 038 * @return a <code>Sink</code> instance with a file as output. 039 * @throws java.io.IOException if any. 040 */ 041 Sink createSink(File outputDir, String outputName) throws IOException; 042 043 /** 044 * Create a <code>Sink</code> into a file using a specified encoding. 045 * 046 * @param outputDir the not-null output dir. 047 * @param outputName the not-null output name. 048 * @param encoding the output encoding. 049 * @return a <code>Sink</code> instance with a file as output and using specified encoding. 050 * @see #createSink(File, String) 051 * @since 1.1 052 * @throws java.io.IOException if any. 053 */ 054 Sink createSink(File outputDir, String outputName, String encoding) throws IOException; 055 056 /** 057 * Create a <code>Sink</code> into an OutputStream. 058 * 059 * @param out not null OutputStream to write the result. 060 * @return a <code>Sink</code> instance. 061 * @since 1.1 062 * @throws java.io.IOException if any. 063 */ 064 Sink createSink(OutputStream out) throws IOException; 065 066 /** 067 * Create a <code>Sink</code> into an OutputStream using a specified encoding. 068 * 069 * @param out not null OutputStream to write the result. 070 * @param encoding the output encoding. 071 * @return a <code>Sink</code> instance using specified encoding. 072 * @since 1.1 073 * @throws java.io.IOException if any. 074 */ 075 Sink createSink(OutputStream out, String encoding) throws IOException; 076}