public int read(char[] buffer,
                   int    offset,
                   int    size)
      throws IOException
   {
      int charsRead = 0;

      if (this.atEndOfData) {
         return -1;
      }

      if ((offset + size) > buffer.length) {
         size = buffer.length - offset;
      }

      while (charsRead < size) {
         char ch = this.savedChar;

         if (ch == 0) {
            ch = this.reader.read();
         } else {
            this.savedChar = 0;
         }

         if (ch == ']') {
            char ch2 = this.reader.read();
            
            if (ch2 == ']') {
               char ch3 = this.reader.read();

               if (ch3 == '>') {
                  this.atEndOfData = true;
                  break;
               }

               this.savedChar = ch2;
               this.reader.unread(ch3);
            } else {
               this.reader.unread(ch2);
            }
         }
         buffer[charsRead] = ch;
         charsRead++;
      }

      if (charsRead == 0) {
         charsRead = -1;
      }

      return charsRead;
   }