Package org.openstreetmap.josm.io
Class XmlWriter
- java.lang.Object
-
- org.openstreetmap.josm.io.XmlWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
GpxWriter
,NoteWriter
,OsmWriter
,PreferencesWriter
,ValidatorErrorWriter
public class XmlWriter extends java.lang.Object implements java.io.Closeable
Helper class to use for xml outputting classes.
-
-
Constructor Summary
Constructors Constructor Description XmlWriter(java.io.PrintWriter out)
Constructs a newXmlWriter
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static java.lang.String
encode(java.lang.String unencoded)
Encode the given string in XML1.0 format.static java.lang.String
encode(java.lang.String unencoded, boolean keepApos)
Encode the given string in XML1.0 format.void
flush()
Flushes the stream.
-
-
-
Constructor Detail
-
XmlWriter
public XmlWriter(java.io.PrintWriter out)
Constructs a newXmlWriter
.- Parameters:
out
- print writer
-
-
Method Detail
-
flush
public void flush()
Flushes the stream.
-
encode
public static java.lang.String encode(java.lang.String unencoded)
Encode the given string in XML1.0 format. Optimized to fast pass strings that don't need encoding (normal case).- Parameters:
unencoded
- the unencoded input string- Returns:
- XML1.0 string
-
encode
public static java.lang.String encode(java.lang.String unencoded, boolean keepApos)
Encode the given string in XML1.0 format. Optimized to fast pass strings that don't need encoding (normal case).- Parameters:
unencoded
- the unencoded input stringkeepApos
- true if apostrophe sign should stay as it is (in order to work around a Java bug that renders new JLabel("<html>'</html>") literally as 6 character string, see #7558)- Returns:
- XML1.0 string
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-