/** Reloads data buffer. */ private void reloadBuffer() throws XMLStreamException { if (_reader == null) throw new XMLStreamException("Input not specified"); _location._column += _readIndex; _location._charactersRead += _readIndex; _readIndex = 0; try { _readCount = _reader.read(_readBuffer, 0, _readBuffer.length); if ((_readCount <= 0) && ((_depth != 0) || (_state != STATE_CHARACTERS))) throw new XMLUnexpectedEndOfDocumentException("Unexpected end of document", _location); } catch (IOException e) { throw new XMLStreamException(e); } while ((_index + _readCount) >= _data.length) { // Potential overflow. increaseDataBuffer(); } }