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