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.settings.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.settings.Settings; 28 import org.apache.maven.settings.v4.SettingsStaxWriter; 29 30 /** 31 * @deprecated Maven 3 compatibility - please use {@code org.apache.maven.api.services.xml.SettingsXmlFactory} from {@code maven-api-core} 32 * or {@link SettingsStaxWriter} 33 */ 34 @Deprecated 35 public class SettingsXpp3Writer { 36 37 private final SettingsStaxWriter delegate; 38 39 public SettingsXpp3Writer() { 40 delegate = new SettingsStaxWriter(); 41 delegate.setAddLocationInformation(false); 42 } 43 /** 44 * Method setFileComment. 45 * 46 * @param fileComment a fileComment object. 47 */ 48 public void setFileComment(String fileComment) { 49 delegate.setFileComment(fileComment); 50 } 51 52 /** 53 * Method write. 54 * 55 * @param writer a writer object. 56 * @param settings a settings object. 57 * @throws IOException java.io.IOException if any. 58 */ 59 public void write(Writer writer, Settings settings) throws IOException { 60 try { 61 delegate.write(writer, settings.getDelegate()); 62 } catch (XMLStreamException e) { 63 throw new IOException(e); 64 } 65 } 66 67 /** 68 * Method write. 69 * 70 * @param stream a stream object. 71 * @param settings a settings object. 72 * @throws IOException java.io.IOException if any. 73 */ 74 public void write(OutputStream stream, Settings settings) throws IOException { 75 try { 76 delegate.write(stream, settings.getDelegate()); 77 } catch (XMLStreamException e) { 78 throw new IOException(e); 79 } 80 } 81 }