Class XmlWriterUtil
- java.lang.Object
-
- org.apache.maven.shared.utils.xml.XmlWriterUtil
-
public class XmlWriterUtil extends java.lang.Object
Utility class for theXmlWriter
class.- Author:
- Vincent Siveton
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_COLUMN_LINE
The default column before line wrapping i.e.static int
DEFAULT_INDENTATION_SIZE
The default line indenter size i.e.static java.lang.String
LS
The vm line separator
-
Constructor Summary
Constructors Constructor Description XmlWriterUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
writeComment(XMLWriter writer, java.lang.String comment)
Convenience method to write XML comment line.static void
writeComment(XMLWriter writer, java.lang.String comment, int indent)
Convenience method to write XML comment line.static void
writeComment(XMLWriter writer, java.lang.String comment, int indent, int indentSize)
Convenience method to write XML comment line.static void
writeComment(XMLWriter writer, java.lang.String comment, int indent, int indentSize, int columnSize)
Convenience method to write XML comment line.static void
writeCommentLineBreak(XMLWriter writer)
Convenience method to write XML comment line break.static void
writeCommentLineBreak(XMLWriter writer, int columnSize)
Convenience method to write XML comment line break withcolumnSize
as length.static void
writeCommentText(XMLWriter writer, java.lang.String comment)
Convenience method to write XML comments between two comments line break.static void
writeCommentText(XMLWriter writer, java.lang.String comment, int indent)
Convenience method to write XML comments between two comments line break.static void
writeCommentText(XMLWriter writer, java.lang.String comment, int indent, int indentSize)
Convenience method to write XML comment between two comment line break.static void
writeCommentText(XMLWriter writer, java.lang.String comment, int indent, int indentSize, int columnSize)
Convenience method to write XML comments between two comments line break.static void
writeLineBreak(XMLWriter writer)
Convenience method to write oneCRLF
.static void
writeLineBreak(XMLWriter writer, int repeat)
Convenience method to repeatCRLF
.static void
writeLineBreak(XMLWriter writer, int repeat, int indent)
Convenience method to repeatCRLF
and to indent the writer by2
.static void
writeLineBreak(XMLWriter writer, int repeat, int indent, int indentSize)
Convenience method to repeatCRLF
and to indent the writer byindentSize
.
-
-
-
Field Detail
-
LS
public static final java.lang.String LS
The vm line separator
-
DEFAULT_INDENTATION_SIZE
public static final int DEFAULT_INDENTATION_SIZE
The default line indenter size i.e. 2.- See Also:
- Constant Field Values
-
DEFAULT_COLUMN_LINE
public static final int DEFAULT_COLUMN_LINE
The default column before line wrapping i.e. 80.- See Also:
- Constant Field Values
-
-
Method Detail
-
writeLineBreak
public static void writeLineBreak(XMLWriter writer) throws java.io.IOException
Convenience method to write oneCRLF
.- Parameters:
writer
- not null writer- Throws:
java.io.IOException
- if writing fails
-
writeLineBreak
public static void writeLineBreak(XMLWriter writer, int repeat) throws java.io.IOException
Convenience method to repeatCRLF
.- Parameters:
writer
- not nullrepeat
- positive number- Throws:
java.io.IOException
- if writing fails
-
writeLineBreak
public static void writeLineBreak(XMLWriter writer, int repeat, int indent) throws java.io.IOException
Convenience method to repeatCRLF
and to indent the writer by2
.- Parameters:
writer
- not nullrepeat
- The number of repetitions of the indentindent
- positive number- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_INDENTATION_SIZE
,writeLineBreak(XMLWriter, int, int, int)
-
writeLineBreak
public static void writeLineBreak(XMLWriter writer, int repeat, int indent, int indentSize) throws java.io.IOException
Convenience method to repeatCRLF
and to indent the writer byindentSize
.- Parameters:
writer
- not nullrepeat
- The number of repetitions of the indentindent
- positive numberindentSize
- positive number- Throws:
java.io.IOException
- if writing fails
-
writeCommentLineBreak
public static void writeCommentLineBreak(XMLWriter writer) throws java.io.IOException
Convenience method to write XML comment line break. Its size is80
.- Parameters:
writer
- not null- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_COLUMN_LINE
,writeCommentLineBreak(XMLWriter, int)
-
writeCommentLineBreak
public static void writeCommentLineBreak(XMLWriter writer, int columnSize) throws java.io.IOException
Convenience method to write XML comment line break withcolumnSize
as length.- Parameters:
writer
- not nullcolumnSize
- positive number- Throws:
java.io.IOException
- if writing fails
-
writeComment
public static void writeComment(XMLWriter writer, java.lang.String comment) throws java.io.IOException
Convenience method to write XML comment line. Thecomment
is split to have a size of80
.- Parameters:
writer
- not nullcomment
- The comment to write- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_INDENTATION_SIZE
,writeComment(XMLWriter, String, int, int)
-
writeComment
public static void writeComment(XMLWriter writer, java.lang.String comment, int indent) throws java.io.IOException
Convenience method to write XML comment line. Thecomment
is split to have a size of80
and is indented byindent
using2
as indentation size.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive number- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_INDENTATION_SIZE
,writeComment(XMLWriter, String, int, int)
-
writeComment
public static void writeComment(XMLWriter writer, java.lang.String comment, int indent, int indentSize) throws java.io.IOException
Convenience method to write XML comment line. Thecomment
is split to have a size of80
and is indented byindent
usingindentSize
.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive numberindentSize
- positive number- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_COLUMN_LINE
,writeComment(XMLWriter, String, int, int, int)
-
writeComment
public static void writeComment(XMLWriter writer, java.lang.String comment, int indent, int indentSize, int columnSize) throws java.io.IOException
Convenience method to write XML comment line. Thecomment
is split to have a size ofcolumnSize
and is indented byindent
usingindentSize
.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive numberindentSize
- positive numbercolumnSize
- positive number- Throws:
java.io.IOException
- if writing fails
-
writeCommentText
public static void writeCommentText(XMLWriter writer, java.lang.String comment) throws java.io.IOException
Convenience method to write XML comments between two comments line break. The XML comment block is not indented.- Parameters:
writer
- not nullcomment
- The comment to write- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_INDENTATION_SIZE
,writeCommentText(XMLWriter, String, int, int)
-
writeCommentText
public static void writeCommentText(XMLWriter writer, java.lang.String comment, int indent) throws java.io.IOException
Convenience method to write XML comments between two comments line break. The XML comment block is also indented byindent
using2
as indentation size.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive number- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_INDENTATION_SIZE
,writeCommentText(XMLWriter, String, int, int)
-
writeCommentText
public static void writeCommentText(XMLWriter writer, java.lang.String comment, int indent, int indentSize) throws java.io.IOException
Convenience method to write XML comment between two comment line break. The XML comment block is also indented byindent
usingindentSize
.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive numberindentSize
- positive number- Throws:
java.io.IOException
- if writing fails- See Also:
DEFAULT_COLUMN_LINE
,writeCommentText(XMLWriter, String, int, int, int)
-
writeCommentText
public static void writeCommentText(XMLWriter writer, java.lang.String comment, int indent, int indentSize, int columnSize) throws java.io.IOException
Convenience method to write XML comments between two comments line break. The XML comment block is also indented byindent
usingindentSize
. The column size could be also be specified.- Parameters:
writer
- not nullcomment
- The comment to writeindent
- positive numberindentSize
- positive numbercolumnSize
- positive number- Throws:
java.io.IOException
- if writing fails
-
-