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

    if (atEndOfData) {
      return -1;
    }

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

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

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

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

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

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

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

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

    return charsRead;
  }
@Override
  public int read(char[] buffer, int offset, int size)