Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ITextSinkFactory |
|
| 1.6666666666666667;1,667 |
1 | package org.apache.maven.doxia.module.itext; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import java.io.Writer; | |
23 | ||
24 | import org.apache.maven.doxia.sink.AbstractTextSinkFactory; | |
25 | import org.apache.maven.doxia.sink.Sink; | |
26 | import org.codehaus.plexus.util.WriterFactory; | |
27 | import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; | |
28 | ||
29 | /** | |
30 | * IText implementation of the Sink factory. | |
31 | * | |
32 | * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a> | |
33 | * @version $Id: ITextSinkFactory.java 785531 2009-06-17 09:47:59Z ltheussl $ | |
34 | * @since 1.0 | |
35 | * @plexus.component role="org.apache.maven.doxia.sink.SinkFactory" role-hint="itext" | |
36 | */ | |
37 | 0 | public class ITextSinkFactory |
38 | extends AbstractTextSinkFactory | |
39 | { | |
40 | /** {@inheritDoc} */ | |
41 | protected Sink createSink( Writer writer, String encoding ) | |
42 | { | |
43 | 0 | return new ITextSink( writer, encoding ); |
44 | } | |
45 | ||
46 | /** | |
47 | * createSink. | |
48 | * | |
49 | * @param writer a {@link java.io.Writer} object. | |
50 | * @return a {@link org.apache.maven.doxia.sink.Sink} object. | |
51 | */ | |
52 | public Sink createSink( Writer writer ) | |
53 | { | |
54 | // TODO: should this method be deprecated? | |
55 | 0 | return createSink( writer, WriterFactory.UTF_8 ); |
56 | } | |
57 | ||
58 | /** | |
59 | * Create a <code>Sink</code> into a PrettyPrintXMLWriter. | |
60 | * | |
61 | * @param xmlWriter not null XML writer to write the result. | |
62 | * @return a <code>Sink</code> instance. | |
63 | */ | |
64 | public Sink createSink( PrettyPrintXMLWriter xmlWriter ) | |
65 | { | |
66 | 0 | if ( xmlWriter == null ) |
67 | { | |
68 | 0 | throw new IllegalArgumentException( "xmlWriter could not be null." ); |
69 | } | |
70 | ||
71 | 0 | return new ITextSink( xmlWriter ); |
72 | } | |
73 | } |