1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.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.model.InputLocation;
28 import org.apache.maven.model.Model;
29 import org.apache.maven.model.v4.MavenStaxWriter;
30
31
32
33
34 @Deprecated
35 public class MavenXpp3Writer {
36
37
38
39
40 private final MavenStaxWriter delegate = new MavenStaxWriter();
41
42
43
44
45
46 public MavenXpp3Writer() {
47 this(false);
48 }
49
50 protected MavenXpp3Writer(boolean addLocationInformation) {
51 delegate.setAddLocationInformation(addLocationInformation);
52 }
53
54
55
56
57
58
59 public void setFileComment(String fileComment) {
60 delegate.setFileComment(fileComment);
61 }
62
63
64
65
66
67
68 public void setStringFormatter(InputLocation.StringFormatter stringFormatter) {
69 delegate.setStringFormatter(
70 stringFormatter != null
71 ? new org.apache.maven.api.model.InputLocation.StringFormatter() {
72 @Override
73 public String toString(org.apache.maven.api.model.InputLocation location) {
74 return stringFormatter.toString(new InputLocation(location));
75 }
76 }
77 : null);
78 }
79
80
81
82
83
84
85
86
87 public void write(Writer writer, Model model) throws IOException {
88 try {
89 delegate.write(writer, model.getDelegate());
90 } catch (XMLStreamException e) {
91 throw new IOException(e);
92 }
93 }
94
95
96
97
98
99
100
101
102 public void write(OutputStream stream, Model model) throws IOException {
103 try {
104 delegate.write(stream, model.getDelegate());
105 } catch (XMLStreamException e) {
106 throw new IOException(e);
107 }
108 }
109 }