}
protected ResponsePAZ parseResp(File file) throws IOException{
ResponsePAZ resPAZ=new ResponsePAZ();
Scanner sc = new Scanner(file);
System.out.println("in parse resp");
try{
StringBuffer name= new StringBuffer("");
List<Complex>zeros=new ArrayList<Complex>();
List<Complex>poles=new ArrayList<Complex>();
//int numZeros;
//int numPoles;
while (sc.hasNextLine()&&resPAZ.getGainFreq()==null) {
// System.out.println(sc.nextLine());
String currentLine=sc.nextLine();
// System.out.println(currentLine);
if(currentLine.startsWith("B050F03")){
String[] tokens= currentLine.split("Station:\\s+");
name.append(tokens[1].trim()).append(".");
}
if(currentLine.startsWith("B050F16")){
String[] tokens= currentLine.split("Network:\\s+");
name.append(tokens[1].trim()).append(".");
}
if(currentLine.startsWith("B052F04")){
String[] tokens= currentLine.split("Channel:\\s+");
name.append(tokens[1].trim()).append(".");
}
if(currentLine.startsWith("B052F22")){
String[] tokens= currentLine.split("Start date:\\s+");
name.append(tokens[1].trim());
resPAZ.setName(name.toString());
}
if(currentLine.startsWith("B053F10-13")){
String[] tokens= currentLine.split("\\s+");
Complex zero=new Complex(new Double(tokens[2].trim()), new Double(tokens[3].trim()));
zeros.add(zero);
}
if(currentLine.startsWith("B053F15-18")){
String[] tokens= currentLine.split("\\s+");
Complex pole=new Complex(new Double(tokens[2].trim()), new Double(tokens[3].trim()));
poles.add(pole);
}
if(currentLine.startsWith("B058F04")){
String[] tokens= currentLine.split("Gain:\\s+");
resPAZ.setGain(new Double(tokens[1].trim()));
}
if(currentLine.startsWith("B058F05")){
String[] tokens= currentLine.split("\\s+");
resPAZ.setGainFreq(new Double(tokens[4].trim()));
//break;
}
}
resPAZ.setZeros(zeros);
resPAZ.setPoles(poles);
}
finally{
sc.close();
}
return resPAZ;