public void close()
      throws IOException
   {
      try {
         int bufferLength = this.buffer.length();

         for (;;) {
            String str = "";
            char ch;

            if (this.bufferIndex >= bufferLength) {
               str = XMLUtil.read(this.reader, '&');
               ch = str.charAt(0);
            } else {
               ch = this.buffer.charAt(this.bufferIndex);
               this.bufferIndex++;
               continue; // don't interprete chars in the buffer
            }

            if (ch == '<') {
               this.reader.unread(ch);
               break;
            }

            if ((ch == '&') && (str.length() > 1)) {
               if (str.charAt(1) != '#') {
                  XMLUtil.processEntity(str, this.reader, this.resolver);
               }
            }
         }
      } catch (XMLParseException e) {
         throw new IOException(e.getMessage());
      }
   }