Package apg
Class UdtLib.LineEnd
- java.lang.Object
-
- apg.Parser.UdtCallback
-
- apg.UdtLib.LineEnd
-
- Direct Known Subclasses:
UdtLib.CRLFLineEnd
,UdtLib.ForgivingLineEnd
,UdtLib.LFLineEnd
- Enclosing class:
- UdtLib
public static class UdtLib.LineEnd extends Parser.UdtCallback
UDT for line end characters. Several conventions are commonly used for line end characters in different common environments. Flexible options are available.
-
-
Field Summary
-
Fields inherited from class apg.Parser.UdtCallback
callbackData
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
callback(int offset)
The UDT function.
-
-
-
Constructor Detail
-
LineEnd
public LineEnd(Parser p)
Default constructor. The "forgiving" line end. Forgiving means that anything resembling either of the two most frequent standards will be accepted. Any of LF (x0A
), CRLF (x0Dx0A
)or CR (x0D
) are accepted as line ends.- Parameters:
p
- the Parser object this UDT is attached to.
-
LineEnd
public LineEnd(Parser p, char end)
Constructor for the single-character line end.- Parameters:
p
- the Parser object this UDT is attached to.end
- the line end character
-
LineEnd
public LineEnd(Parser p, char end1, char end2)
Constructor for the double-character line end.- Parameters:
p
- the Parser object this UDT is attached to.end1
- the first of the line end character pairend2
- the second of the line end character pair
-
-
Method Detail
-
callback
public int callback(int offset)
Description copied from class:Parser.UdtCallback
The UDT function.- Specified by:
callback
in classParser.UdtCallback
- Parameters:
offset
- offset into the input string to the first character of the parsed phrase.- Returns:
- the matched phrase length,
L
, or-1
if no phrase was matched. The phrase length must be in the range0 <= L <=(n-1)
, wheren
is the remaining number of characters in the input string.
-
-