public boolean headerEquals(byte[] buf) {
		if (beginPos < 0 && equalsPos < 0) {
			// header is completely in prevBuf
			int bufLen = buf.length;
			int beginLen = equalsPos - beginPos;
			return bufLen == beginLen && equals(prevBuf, buf, beginPos - shift, 0, bufLen);
		} else if (beginPos >=0 && equalsPos >=0) {
			// header is completely in newBuf
			int bufLen = buf.length;
			int beginLen = equalsPos - beginPos;
			return bufLen == beginLen && equals(newBuf, buf, beginPos, 0, bufLen);
		}
		// header is splitted
		int bufLen = buf.length;
		int rBegin = beginPos - shift;
		int beginLen = prevBuf.length - rBegin;
		
		return bufLen == beginLen + equalsPos &&
				equals(prevBuf, buf, rBegin, 0, beginLen) &&
				equals(newBuf, buf, 0, beginLen, equalsPos);
	}