Copied from {@link com.android.volley.toolbox.BasicNetwork}

Converts Headers[] to Map<String, String>.
195422
private static Map<String, String> convertHeaders(Header[] headers) {
        Map<String, String> result = new HashMap<String, String>(headers.length);
		for (Header header : headers) {
			result.put(header.getName(), header.getValue());
		}
        return result;
    }
322726
public Map<String, Collection<String>> toMap() {
        Map<String, Collection<String>> params = new HashMap<String, Collection<String>>();
        if (null != type) {
            ArrayList<String> valueList = new ArrayList<String>();
            valueList.add(type);
            params.put("type", valueList);
        }
        if (null != data) {
            ArrayList<String> valueList = new ArrayList<String>();
            valueList.add(data);
            params.put("data", valueList);
        }

        return params;
    }
1257222
private void setHeaderList(Map<String, List<String>> headers, String name, String value) {

        List<String> values = new ArrayList<String>();
        values.add(SET_HEADER + value);
        headers.put(name, values);
    }
1354752
public Map<String, String> toMap() {
        final Map<String, String> result = new HashMap<>();
        for (final HttpHeader header : headers.values()) {
            result.put(header.name(), header.value());
        }
        return result;
    }
1113023
@SuppressWarnings("unchecked")
	public T setHeaders(final Map<String, List<String>> headers) {
		this.headers = headers;
		return (T) this;
	}
95089
private InternetHeaders parseHeaders(DataSource ds) {
        try {
            return new InternetHeaders(ds.getInputStream());
        } catch (MessagingException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1369663
private Map<String, Object> convertHeaderTypes(Map<String, Object> headers) {
        Map<String, Object> convertedHeaders = new HashMap<>();

        for (Map.Entry<String, Object> header : headers.entrySet()) {
            if (header.getValue() instanceof Collection<?>) {
                Collection<?> value = (Collection<?>)header.getValue();
                convertedHeaders.put(header.getKey(), StringUtils.collectionToCommaDelimitedString(value));
            } else if (header.getValue() instanceof MediaType) {
                convertedHeaders.put(header.getKey(), header.getValue().toString());
            } else {
                convertedHeaders.put(header.getKey(), header.getValue());
            }
        }

        return convertedHeaders;
    }
503173
public Header[] head(String endpoint, String params) throws IOException {
        return this.head(endpoint, params, "");
    }
693140
private String[] extractHeaderList(String headerList, int prefixLen) {
        // Remove the trailing and leading ')('
        String tmp = headerList.substring(prefixLen + 1, headerList.length() - 1);
        return split(tmp, " ");
    }
410334
@Override
    public Collection<String> getHeaders(String name) {
        return (headers != null ? headers.get(name) : null);
    }
203032
public Map<String, String> getHeaders() {
    final Map<String, String> headers = new HashMap<String, String>(
        request.headers().entries().size());
    for (final Entry<String, String> header : request.headers().entries()) {
      // http://tools.ietf.org/html/rfc2616#section-4.2
      if (headers.containsKey(header.getKey())) {
        headers.put(header.getKey(), 
            headers.get(header.getKey()) + "," + header.getValue());
      } else {
        headers.put(header.getKey(), header.getValue());
      }
    }
    return headers;
  }
734871
protected void readArrayHeader() throws IOException {
        if (jsonParser.nextToken() != JsonToken.START_OBJECT) {
            throw new JsonParseException("Not a Json object", jsonParser.getCurrentLocation());
        }

        jsonParser.nextToken();
        if (!jsonParser.getText().equals(RECORDS)) {
            throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation());
        }

        if (jsonParser.nextToken() != JsonToken.START_ARRAY) {
            throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation());
        }
    }
53000
public String[] getHeader() {
        
        return columns.stream()
            .map(c -> headerMapper.toMap(c, configuration, groups))
            .toArray(n -> new String[n]);
        
    }
966303
public String[] getHeaders(String name) {
        List<String> headerList = httpRequest.headers().getAll(name);
        return headerList.toArray(new String[0]);
    }
210809
Header readHeader(@NonNull ArrayView input) throws SerializationException {
        byte version = input.get(VERSION_POSITION);
        int keyLength = BitConverter.readInt(input, KEY_POSITION);
        int valueLength = BitConverter.readInt(input, VALUE_POSITION);
        long entryVersion = BitConverter.readLong(input, ENTRY_VERSION_POSITION);
        validateHeader(keyLength, valueLength);
        return new Header(version, keyLength, valueLength, entryVersion);
    }
1187920
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;
	}
536511
public Map<String, List<String>> getHeaders() {
        if (headers == null) {
            return null;
        }
        return headers.toMultimap();
    }