Package org.apache.guacamole.protocol
Class GuacamoleParser
java.lang.Object
org.apache.guacamole.protocol.GuacamoleParser
- All Implemented Interfaces:
Iterator<GuacamoleInstruction>
Parser for the Guacamole protocol. Arbitrary instruction data is appended,
and instructions are returned as a result. Invalid instructions result in
exceptions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The maximum number of digits to allow per length prefix.static final int
The maximum number of elements per instruction, including the opcode.static final int
The maximum number of characters per instruction. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
INSTRUCTION_MAX_LENGTH
public static final int INSTRUCTION_MAX_LENGTHThe maximum number of characters per instruction.- See Also:
-
INSTRUCTION_MAX_DIGITS
public static final int INSTRUCTION_MAX_DIGITSThe maximum number of digits to allow per length prefix.- See Also:
-
INSTRUCTION_MAX_ELEMENTS
public static final int INSTRUCTION_MAX_ELEMENTSThe maximum number of elements per instruction, including the opcode.- See Also:
-
-
Constructor Details
-
GuacamoleParser
public GuacamoleParser()
-
-
Method Details
-
append
Appends data from the given buffer to the current instruction.- Parameters:
chunk
- The buffer containing the data to append.offset
- The offset within the buffer where the data begins.length
- The length of the data to append.- Returns:
- The number of characters appended, or 0 if complete instructions have already been parsed and must be read via next() before more data can be appended.
- Throws:
GuacamoleException
- If an error occurs while parsing the new data.
-
append
Appends data from the given buffer to the current instruction.- Parameters:
chunk
- The data to append.- Returns:
- The number of characters appended, or 0 if complete instructions have already been parsed and must be read via next() before more data can be appended.
- Throws:
GuacamoleException
- If an error occurs while parsing the new data.
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<GuacamoleInstruction>
-
next
- Specified by:
next
in interfaceIterator<GuacamoleInstruction>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<GuacamoleInstruction>
-