private byte[] readName() throws IOException {
		int nameLen = 0;

		is.mark(1024);
		int b = is.read();
		for (; b != -1 && b != '\n'; nameLen++, b = is.read())
			;
		if (b == -1)
			throw new EOFException("Unexpected end of fastq stream.");

		is.reset();

		byte[] name = null;
		if (stripSegmentIndexFromReadName) {
			is.skip(nameLen - 2);
			switch (is.read()) {
			case -1:
				throw new EOFException("Unexpected end of fastq stream.");
			case '/':
				indexInSegment = is.read();
				if (indexInSegment == -1)
					throw new EOFException("Unexpected end of fastq stream.");

				if (indexInSegment > 0) {
					is.reset();
					name = Utils.readFully(is, nameLen - 2);
					// a slash, a digit and a new line:
					is.skip(3);
				} else
					indexInSegment = 0;
				break;

			default:
				break;
			}
		}

		if (name == null) {
			is.reset();
			name = Utils.readFully(is, nameLen);
			// skip new line byte:
			is.skip(1);
		}

		return name;
	}