// 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;
			nextCharacter = charBuffer[count - 1];
		} else if (count > 0 && count < amount) {
			result = new String(charBuffer, 0, count);
			nextCharacter = -1;
		} else {
			result = "";
			nextCharacter = -1;
		}

		return result;
	}
	
	/**
	 * Reads specified amount of characters. It is needed because when
	 * reading from console {@link Reader#read(char[])} it returns 
	 * after first end of line (probably it checks if characters are available).
	 * @param reader input
	 * @param buffer buffer where read characters will be stored
	 * @return number of read characters
	 */
	private int read(Reader reader, char[] buffer) {
		try {
			int start = 0;
			int count;
			while (((count = reader.read(buffer, start, buffer.length - start)) != -1)
					&& start < buffer.length) {
				start += count;
			}
			return start;
		} 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/TextManager.java
import java.io.IOException;
import java.io.Reader;
import net.loomchild.segment.util.IORuntimeException;

			nextCharacter = charBuffer[count - 1];
		} else if (count > 0 && count < amount) {
			result = new String(charBuffer, 0, count);
			nextCharacter = -1;
		} else {
			result = "";
			nextCharacter = -1;
		}

		return result;
	}
	
	/**
	 * Reads specified amount of characters. It is needed because when
	 * reading from console {@link Reader#read(char[])} it returns 
	 * after first end of line (probably it checks if characters are available).
	 * @param reader input
	 * @param buffer buffer where read characters will be stored
	 * @return number of read characters
	 */
	private int read(Reader reader, char[] buffer) {
		try {
			int start = 0;
			int count;
			while (((count = reader.read(buffer, start, buffer.length - start)) != -1)
					&& start < buffer.length) {
				start += count;
			}
			return start;
		} catch (IOException e) {
			throw new IORuntimeException(e);