1 /******************************************************************************* 2 * Copyright (c) 2008, 2018 Wind River Systems and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Wind River Systems - initial API and implementation 13 * IBM Corporation - bug fixing 14 *******************************************************************************/ 15 package org.eclipse.debug.examples.core.pda.protocol; 16 17 import java.util.ArrayList; 18 import java.util.List; 19 import java.util.StringTokenizer; 20 21 22 /** 23 * @see PDADataCommand 24 */ 25 26 public class PDAListResult extends PDACommandResult { 27 28 final public String[] fValues; 29 PDAListResult(String response)30 PDAListResult(String response) { 31 super(response); 32 StringTokenizer st = new StringTokenizer(response, "|"); //$NON-NLS-1$ 33 List<String> valuesList = new ArrayList<>(); 34 35 while (st.hasMoreTokens()) { 36 String token = st.nextToken(); 37 if (token.length() != 0) { 38 valuesList.add(token); 39 } 40 } 41 42 fValues = new String[valuesList.size()]; 43 for (int i = 0; i < valuesList.size(); i++) { 44 fValues[i] = valuesList.get(i); 45 } 46 } 47 } 48