View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.doxia.sink;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.io.OutputStream;
24  
25  /**
26   * A factory that creates a <code>Sink</code> object.
27   *
28   * @author <a href="kenney@apache.org">Kenney Westerhof</a>
29   * @since 1.0-alpha-9
30   */
31  public interface SinkFactory {
32  
33      /**
34       * Create a <code>Sink</code> into a file.
35       *
36       * @param outputDir the not-null output dir.
37       * @param outputName the not-null output name.
38       * @return a <code>Sink</code> instance with a file as output.
39       * @throws java.io.IOException if any.
40       */
41      Sink createSink(File outputDir, String outputName) throws IOException;
42  
43      /**
44       * Create a <code>Sink</code> into a file using a specified encoding.
45       *
46       * @param outputDir the not-null output dir.
47       * @param outputName the not-null output name.
48       * @param encoding the output encoding.
49       * @return a <code>Sink</code> instance with a file as output and using specified encoding.
50       * @see #createSink(File, String)
51       * @since 1.1
52       * @throws java.io.IOException if any.
53       */
54      Sink createSink(File outputDir, String outputName, String encoding) throws IOException;
55  
56      /**
57       * Create a <code>Sink</code> into an OutputStream.
58       *
59       * @param out not null OutputStream to write the result.
60       * @return a <code>Sink</code> instance.
61       * @since 1.1
62       * @throws java.io.IOException if any.
63       */
64      Sink createSink(OutputStream out) throws IOException;
65  
66      /**
67       * Create a <code>Sink</code> into an OutputStream using a specified encoding.
68       *
69       * @param out not null OutputStream to write the result.
70       * @param encoding the output encoding.
71       * @return a <code>Sink</code> instance using specified encoding.
72       * @since 1.1
73       * @throws java.io.IOException if any.
74       */
75      Sink createSink(OutputStream out, String encoding) throws IOException;
76  }