@Override
	public int read() throws IOException {
		if (nextBytes == null) {
			initNextBytes();
		}
		if (endReached) {
			return -1;
		}
		if (lastBytesAreCrLf() && nextBytesAreDotCrLf()) {
			endReached = true;
			return -1;
		}
		final int result = nextBytes[0];
		if (result == -1) {
			// End of stream reached without seeing the terminator
			throw new EOFException("Pre-mature end of <CRLF>.<CRLF> terminated data");
		}
		readWrappedStream();
		return result;
	}
A constructor for this object that takes a stream to be wrapped and a
terminating character sequence.

@param in the <code>InputStream</code> to be wrapped
@throws IllegalArgumentException if the terminator array is null or empty
src/main/java/de/gessnerfl/fakesmtp/smtp/io/DotTerminatedInputStream.java