Class SnippetReader
- java.lang.Object
-
- org.apache.maven.doxia.macro.snippet.SnippetReader
-
public class SnippetReader extends java.lang.ObjectUtility class for reading snippets.
-
-
Constructor Summary
Constructors Constructor Description SnippetReader(java.net.URL src)Constructor.SnippetReader(java.net.URL src, java.lang.String encoding)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intindent(java.lang.String line)Returns the indent of the given line.protected static booleanisDemarcator(java.lang.String snippetId, java.lang.String what, java.lang.String line)Determines if the given line is a demarcator.protected booleanisEnd(java.lang.String snippetId, java.lang.String line)Determines if the given line is an end demarcator.protected booleanisStart(java.lang.String snippetId, java.lang.String line)Determines if the given line is a start demarcator.(package private) intminIndent(java.util.List<java.lang.String> lines)Returns the minimal indent of all the lines in the given List.private java.util.List<java.lang.String>readLines(java.lang.String snippetId)Reads the snippet and returns the lines in a List.java.lang.StringBufferreadSnippet(java.lang.String snippetId)Reads the snippet with given id.
-
-
-
Method Detail
-
readSnippet
public java.lang.StringBuffer readSnippet(java.lang.String snippetId) throws java.io.IOExceptionReads the snippet with given id.- Parameters:
snippetId- The id of the snippet.- Returns:
- The snippet.
- Throws:
java.io.IOException- if something goes wrong.
-
minIndent
int minIndent(java.util.List<java.lang.String> lines)
Returns the minimal indent of all the lines in the given List.- Parameters:
lines- A List of lines.- Returns:
- the minimal indent.
-
indent
int indent(java.lang.String line)
Returns the indent of the given line.- Parameters:
line- A line.- Returns:
- the indent.
-
readLines
private java.util.List<java.lang.String> readLines(java.lang.String snippetId) throws java.io.IOExceptionReads the snippet and returns the lines in a List.- Parameters:
snippetId- The id of the snippet.- Returns:
- A List of lines.
- Throws:
java.io.IOException- if something goes wrong.
-
isStart
protected boolean isStart(java.lang.String snippetId, java.lang.String line)Determines if the given line is a start demarcator.- Parameters:
snippetId- the id of the snippet.line- the line.- Returns:
- True, if the line is a start demarcator.
-
isDemarcator
protected static boolean isDemarcator(java.lang.String snippetId, java.lang.String what, java.lang.String line)Determines if the given line is a demarcator.- Parameters:
snippetId- the id of the snippet.what- Identifier for the demarcator.line- the line.- Returns:
- True, if the line is a start demarcator.
-
isEnd
protected boolean isEnd(java.lang.String snippetId, java.lang.String line)Determines if the given line is an end demarcator.- Parameters:
snippetId- the id of the snippet.line- the line.- Returns:
- True, if the line is an end demarcator.
-
-