while(true) { int read = is.read(); if (read < 0) { return null; } if (read != '\n' && read != '\r') { line.append((char) read); continue; }  if (read == '\r') { is.mark(1); read = is.read(); if (read < 0) { return null; } if (read != '\n') { is.reset(); } } String lineStr = line.toString(); if (lineStr.trim().length() == 0) {  break; }
boolean firstLine = true; while (true) { int read = is.read(); if (read < 0) { return null; } if (read != '\n' && read != '\r') { line.append((char) read); continue; }  if (read == '\r') { is.mark(1); read = is.read(); if (read < 0) { return null; } if (read != '\n') { is.reset(); } } String lineStr = line.toString(); if (lineStr.trim().length() == 0) { if (firstLine) { line = new StringBuffer(); firstLine = false; continue; }  break; } firstLine = false;
    private DAVStatus readHeader(Map headerProperties) throws IOException {        DAVStatus responseCode = null;        StringBuffer line = new StringBuffer();        InputStream is = getInputStream();        while(true) {        	int read = is.read();        	if (read < 0) {        		return null;        	}        	if (read != '\n' && read != '\r') {        		line.append((char) read);        		continue;        	}     		// eol read.    		if (read == '\r') {    			is.mark(1);    			read = is.read();    			if (read < 0) {    				return null;    			}    			if (read != '\n') {    				is.reset();    			}    		}    		String lineStr = line.toString();    		if (lineStr.trim().length() == 0) {    			// first empty line (+ eol) read.    			break;    		}            int index = line.indexOf(":");            if (index >= 0 && headerProperties != null) {                String name = line.substring(0, index);                String value = line.substring(index + 1);                headerProperties.put(name.trim(), value.trim());            } else if (responseCode == null) {                responseCode = DAVStatus.parse(lineStr);            }        	        	line.delete(0, line.length());        }        return responseCode;    }