@Override
  public int read(char[] buffer, int offset, int size) throws IOException {
    if (atEndOfData) {
      return -1;
    }

    int charsRead = 0;

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

    while (charsRead < size) {
      char ch = reader.read();

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

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

        reader.unread(ch2);
      }

      buffer[charsRead] = ch;
      charsRead++;
    }

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

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