Package org.forgerock.opendj.ldap
Class GserParser
- java.lang.Object
-
- org.forgerock.opendj.ldap.GserParser
-
public final class GserParser extends Object
This class implements a parser for strings which are encoded using the Generic String Encoding Rules (GSER) defined in RFC 3641.
-
-
Constructor Summary
Constructors Constructor Description GserParser(CharSequence value)
Creates a new GSER Parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Determines if the GSER String contains at least one character to be read.BigInteger
nextBigInteger()
Returns the next element as a BigInteger.String
nextChoiceValueIdentifier()
Return the identifier of the next IdentifiedChoiceValue element.int
nextInteger()
Returns the next element as an Integer.String
nextNamedValueIdentifier()
Returns the identifier of the next NamedValue element.String
nextString()
Returns the next element as a String.GserParser
readEndSequence()
Skips the input matching the end of a sequence and preceding space characters.GserParser
readStartSequence()
Skips the input matching the start of a sequence and subsequent space characters.GserParser
skipMsp()
Skips the input matching one or more space characters.GserParser
skipSeparator()
Skips the input matching the separator pattern (",") and subsequenct space characters.GserParser
skipSp()
Skips the input matching zero, one or more space characters.String
toString()
Returns the GSER encoded String value.
-
-
-
Constructor Detail
-
GserParser
public GserParser(CharSequence value)
Creates a new GSER Parser.- Parameters:
value
- the GSER encoded String value
-
-
Method Detail
-
hasNext
public boolean hasNext()
Determines if the GSER String contains at least one character to be read.- Returns:
true
if there is at least one remaining character orfalse
otherwise.
-
skipSp
public GserParser skipSp() throws DecodeException
Skips the input matching zero, one or more space characters.- Returns:
- reference to this GSERParser
- Throws:
DecodeException
- If no match could be found
-
skipMsp
public GserParser skipMsp() throws DecodeException
Skips the input matching one or more space characters.- Returns:
- reference to this GSERParser
- Throws:
DecodeException
- If no match could be found
-
readStartSequence
public GserParser readStartSequence() throws DecodeException
Skips the input matching the start of a sequence and subsequent space characters.- Returns:
- reference to this GSERParser
- Throws:
DecodeException
- If the input does not match the start of a sequence
-
readEndSequence
public GserParser readEndSequence() throws DecodeException
Skips the input matching the end of a sequence and preceding space characters.- Returns:
- reference to this GSERParser
- Throws:
DecodeException
- If the input does not match the end of a sequence
-
skipSeparator
public GserParser skipSeparator() throws DecodeException
Skips the input matching the separator pattern (",") and subsequenct space characters.- Returns:
- reference to this GSERParser
- Throws:
DecodeException
- If the input does not match the separator pattern.
-
nextString
public String nextString() throws DecodeException
Returns the next element as a String.- Returns:
- the input matching the String pattern
- Throws:
DecodeException
- If the input does not match the string pattern.
-
nextInteger
public int nextInteger() throws DecodeException
Returns the next element as an Integer.- Returns:
- the input matching the integer pattern
- Throws:
DecodeException
- If the input does not match the integer pattern
-
nextBigInteger
public BigInteger nextBigInteger() throws DecodeException
Returns the next element as a BigInteger.- Returns:
- the input matching the integer pattern
- Throws:
DecodeException
- If the input does not match the integer pattern
-
nextNamedValueIdentifier
public String nextNamedValueIdentifier() throws DecodeException
Returns the identifier of the next NamedValue element.- Returns:
- the identifier of the NamedValue element
- Throws:
DecodeException
- If the input does not match the identifier pattern of a NamedValue
-
nextChoiceValueIdentifier
public String nextChoiceValueIdentifier() throws DecodeException
Return the identifier of the next IdentifiedChoiceValue element.- Returns:
- the identifier of the IdentifiedChoiceValue element
- Throws:
DecodeException
- If the input does not match the identifier pattern of an IdentifiedChoiceValue
-
-