2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mpd.internal.protocol;
15 import java.util.HashMap;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * Class for parsing a response from a Music Player Daemon.
23 * @author Stefan Röllin - Initial contribution
26 public class MPDResponseParser {
28 static Map<String, String> responseToMap(MPDResponse response) {
29 Map<String, String> map = new HashMap<String, String>();
31 for (String line : response.getLines()) {
32 int offset = line.indexOf(':');
34 String key = line.substring(0, offset);
35 String value = line.substring(offset + 1).trim();