protected Map<String,String> getHeadersMap(String headerPart) {
		final int len = headerPart.length();
		final Map<String,String> headers = new HashMap<String,String>();

		int start = 0;
		for (;;) {
			int end = parseEndOfLine(headerPart, start);
			if (start == end) {
				break;
			}
			String header = headerPart.substring(start, end);
			start = end + 2;
			while (start < len) {
				int nonWs = start;
				while (nonWs < len) {
					char c = headerPart.charAt(nonWs);
					if (c != ' '  &&  c != '\t') {
						break;
					}
					++nonWs;
				}
				if (nonWs == start) {
					break;
				}
				// continuation line found
				end = parseEndOfLine(headerPart, nonWs);
				header += " " + headerPart.substring(nonWs, end);
				start = end + 2;
			}

			// parse header line
			final int colonOffset = header.indexOf(':');
			if (colonOffset == -1) {
				// this header line is malformed, skip it.
				continue;
			}
			String headerName = header.substring(0, colonOffset).trim();
			String headerValue = header.substring(header.indexOf(':') + 1).trim();

			if (headers.containsKey(headerName)) {
				headers.put( headerName, headers.get(headerName) + "," + headerValue );
			} else {
				headers.put(headerName, headerValue);
			}
		}

		return headers;
	}
protected Map < String , String > getHeadersMap ( String headerPart ) { final int len = headerPart . length ( ) ; final Map < String , String > headers = new HashMap < String , String > ( ) ; int start = 0 ; for ( ; ; ) { int end = parseEndOfLine ( headerPart , start ) ; if ( start == end ) { break ; } String header = headerPart . substring ( start , end ) ; start = end + 2 ; while ( start < len ) { int nonWs = start ; while ( nonWs < len ) { char c = headerPart . charAt ( nonWs ) ; if ( c != ' ' && c != '\t' ) { break ; } ++ nonWs ; } if ( nonWs == start ) { break ; } end = parseEndOfLine ( headerPart , nonWs ) ; header += " " + headerPart . substring ( nonWs , end ) ; start = end + 2 ; } final int colonOffset = header . indexOf ( ':' ) ; if ( colonOffset == - 1 ) { continue ; } String headerName = header . substring ( 0 , colonOffset ) . trim ( ) ; String headerValue = header . substring ( header . indexOf ( ':' ) + 1 ) . trim ( ) ; if ( headers . containsKey ( headerName ) ) { headers . put ( headerName , headers . get ( headerName ) + "," + headerValue ) ; } else { headers . put ( headerName , headerValue ) ; } } return headers ; }
Retreives a map with the headers of a part.

@param headerPart a String object with the contents of the part header.

@return a Map<String,String> object with the headers of the part.