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.toolchain.model.io.xpp3;
20
21 import javax.xml.stream.XMLStreamException;
22
23 import java.io.IOException;
24 import java.io.OutputStream;
25 import java.io.Writer;
26
27 import org.apache.maven.toolchain.model.PersistedToolchains;
28 import org.apache.maven.toolchain.v4.MavenToolchainsStaxWriter;
29
30 /**
31 *
32 * @deprecated use MavenToolchainsStaxWriter.
33 */
34 @Deprecated(since = "4.0.0")
35 public class MavenToolchainsXpp3Writer {
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
39
40 private final MavenToolchainsStaxWriter delegate;
41
42 public MavenToolchainsXpp3Writer() {
43 delegate = new MavenToolchainsStaxWriter();
44 delegate.setAddLocationInformation(false);
45 }
46
47 /**
48 * Method setFileComment.
49 *
50 * @param fileComment a fileComment object.
51 */
52 public void setFileComment(String fileComment) {
53 delegate.setFileComment(fileComment);
54 }
55
56 /**
57 * Method write.
58 *
59 * @param writer a writer object.
60 * @param persistedToolchains a persistedToolchains object.
61 * @throws IOException java.io.IOException if any.
62 */
63 public void write(Writer writer, PersistedToolchains persistedToolchains) throws IOException {
64 try {
65 delegate.write(writer, persistedToolchains.getDelegate());
66 } catch (XMLStreamException e) {
67 throw new IOException(e);
68 }
69 }
70
71 /**
72 * Method write.
73 *
74 * @param stream a stream object.
75 * @param persistedToolchains a persistedToolchains object.
76 * @throws IOException java.io.IOException if any.
77 */
78 public void write(OutputStream stream, PersistedToolchains persistedToolchains) throws IOException {
79 try {
80 delegate.write(stream, persistedToolchains.getDelegate());
81 } catch (XMLStreamException e) {
82 throw new IOException(e);
83 }
84 }
85 }