public function nextTree($input = NULL)
 {
     if ($input != NULL) {
         $this->_input = $input;
     }
     $stanzaFlag = ($this->peekInt8() & 0xf0) >> 4;
     $stanzaSize = $this->peekInt16(1);
     if ($stanzaSize > strlen($this->_input)) {
         $exception = new IncompleteMessageException("Incomplete message");
         $exception->setInput($this->_input);
         throw $exception;
     }
     $this->readInt24();
     if ($stanzaFlag & 8 && isset($this->_key)) {
         $remainingData = substr($this->_input, $stanzaSize);
         $this->_input = $this->_key->decode($this->_input, 0, $stanzaSize) . $remainingData;
     }
     if ($stanzaSize > 0) {
         return $this->nextTreeInternal();
     }
     return NULL;
 }
 public function nextTree($input = NULL)
 {
     if ($input != NULL) {
         $this->_input = $input;
     }
     $stanzaSize = $this->peekInt16();
     if ($stanzaSize > strlen($this->_input)) {
         $exception = new IncompleteMessageException("Incomplete message");
         $exception->setInput($this->_input);
         throw $exception;
     }
     $this->readInt16();
     if ($stanzaSize > 0) {
         return $this->nextTreeInternal();
     }
     return NULL;
 }