private void handleCommand() throws IOException
   {
      boolean commandHasParameter = false;
      boolean parameterIsNegative = false;
      int parameterValue = 0;
      StringBuilder commandText = new StringBuilder();
      StringBuilder parameterText = new StringBuilder();

      int ch = source.read();
      if (ch == -1)
      {
         throw new EOFException();
      }

      commandText.append((char) ch);

      if (!Character.isLetter(ch))
      {
         handleCommand(commandText, 0, commandHasParameter);
         return;
      }

      while (true)
      {
         ch = source.read();
         if (ch == -1 || !Character.isLetter(ch))
         {
            break;
         }
         commandText.append((char) ch);
         if (commandText.length() > MAX_COMMAND_LENGTH)
         {
            break;
         }
      }

      if (ch == -1)
      {
         throw new EOFException();
      }

      if (commandText.length() > MAX_COMMAND_LENGTH)
      {
         throw new IllegalArgumentException("Invalid keyword: " + commandText.toString());
      }

      if (ch == '-')
      {
         parameterIsNegative = true;
         ch = source.read();
         if (ch == -1)
         {
            throw new EOFException();
         }
      }
      if (Character.isDigit(ch))
      {
         commandHasParameter = true;
         parameterText.append((char) ch);
         while (true)
         {
            ch = source.read();
            if (ch == -1 || !Character.isDigit(ch))
            {
               break;
            }
            parameterText.append((char) ch);
            if (parameterText.length() > MAX_PARAMETER_LENGTH)
            {
               break;
            }
         }

         if (parameterText.length() > MAX_PARAMETER_LENGTH)
         {
            throw new IllegalArgumentException("Invalid parameter: " + parameterText.toString());
         }

         parameterValue = Integer.parseInt(parameterText.toString());
         if (parameterIsNegative)
         {
            parameterValue = -parameterValue;
         }
      }

      if (ch != ' ')
      {
         source.unread(ch);
      }

      handleCommand(commandText, parameterValue, commandHasParameter);
   }