// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java
// public class IORuntimeException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -6587044052300876023L;
// 
// 	public IORuntimeException(IOException exception) {
// 		super(exception);
// 	}
// 
// 	public void rethrow() throws IOException {
// 		throw (IOException) getCause();
// 	}
// 
// }


import java.io.IOException;
import java.io.Reader;
import net.loomchild.segment.util.IORuntimeException;
	 * buffer            |-|-|-|-|-|
	 *                    0 1 2 3 4 
	 * 
	 * relative index = 2
	 * </pre>
	 * 
	 * @param index sequence index
	 * @return buffer relative index
	 */
	private int getRelativeIndex(int index) {
		return index - (position - buffer.length());
	}
	
	private int getMinIndex() {
		return position - buffer.length();		
	}

	private void fillBuffer(int index) {
		// Index can be MAX_INT so all arithmetic operations should be
		// on the left side of equation to avoid integer overflow.
		while (index >= position - lookahead && position < length) {
			readCharacter();
		}
	}

	private void readCharacter() {
		int readResult;
		try {
			readResult = reader.read();
		} catch (IOException e) {
// Path: segment/src/main/java/net/loomchild/segment/util/IORuntimeException.java
// public class IORuntimeException extends RuntimeException {
// 
// 	private static final long serialVersionUID = -6587044052300876023L;
// 
// 	public IORuntimeException(IOException exception) {
// 		super(exception);
// 	}
// 
// 	public void rethrow() throws IOException {
// 		throw (IOException) getCause();
// 	}
// 
// }


// Path: segment/src/main/java/net/loomchild/segment/srx/legacy/ReaderCharSequence.java
import java.io.IOException;
import java.io.Reader;
import net.loomchild.segment.util.IORuntimeException;

	 * buffer            |-|-|-|-|-|
	 *                    0 1 2 3 4 
	 * 
	 * relative index = 2
	 * </pre>
	 * 
	 * @param index sequence index
	 * @return buffer relative index
	 */
	private int getRelativeIndex(int index) {
		return index - (position - buffer.length());
	}
	
	private int getMinIndex() {
		return position - buffer.length();		
	}

	private void fillBuffer(int index) {
		// Index can be MAX_INT so all arithmetic operations should be
		// on the left side of equation to avoid integer overflow.
		while (index >= position - lookahead && position < length) {
			readCharacter();
		}
	}

	private void readCharacter() {
		int readResult;
		try {
			readResult = reader.read();
		} catch (IOException e) {
			throw new IORuntimeException(e);