Former-commit-id:580e2938d7
[formerly66be3bec40
] [formerly580e2938d7
[formerly66be3bec40
] [formerlyc83e5ff474
[formerly 2a9569942c48542cf708b6c0b9189146fd954c11]]] Former-commit-id:c83e5ff474
Former-commit-id:82300ccdcf
[formerly1faae42484
] Former-commit-id:21d2361f00
74 lines
2.2 KiB
Java
74 lines
2.2 KiB
Java
/**
|
|
* This software was developed and / or modified by Raytheon Company,
|
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
*
|
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
* This software product contains export-restricted data whose
|
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
* to non-U.S. persons whether in the United States or abroad requires
|
|
* an export license or other authorization.
|
|
*
|
|
* Contractor Name: Raytheon Company
|
|
* Contractor Address: 6825 Pine Street, Suite 340
|
|
* Mail Stop B8
|
|
* Omaha, NE 68106
|
|
* 402.291.0100
|
|
*
|
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
* further licensing information.
|
|
**/
|
|
/**
|
|
*
|
|
*/
|
|
package com.raytheon.viz.gfe.contours;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
|
|
/**
|
|
* @author wdougherty
|
|
*
|
|
*/
|
|
public class FloatArrayReader {
|
|
|
|
public static float[] read(String fname, int size) {
|
|
float[] expectedA = new float[size];
|
|
|
|
BufferedReader reader = null;
|
|
try {
|
|
File file = new File(fname);
|
|
FileInputStream fileInStream = new FileInputStream(file);
|
|
InputStreamReader ireader = new InputStreamReader(fileInStream);
|
|
reader = new BufferedReader(ireader);
|
|
|
|
String[] valStrings;
|
|
int xxx = 0;
|
|
for (String line = reader.readLine(); line != null; line = reader
|
|
.readLine()) {
|
|
line = line.replaceAll("[{};]", "");
|
|
valStrings = line.split(",\\s?");
|
|
for (String valString : valStrings) {
|
|
if (!"".equals(valString.trim())) {
|
|
expectedA[xxx++] = Float.parseFloat(valString);
|
|
}
|
|
}
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
throw new RuntimeException("Error reading array", e);
|
|
} finally {
|
|
try {
|
|
if (reader != null) {
|
|
reader.close();
|
|
}
|
|
} catch (IOException e) {
|
|
; // ignore
|
|
}
|
|
}
|
|
return expectedA;
|
|
}
|
|
|
|
}
|