Zasadniczy wsad inicjalizacyjny.
This commit is contained in:
58
src/main/java/pl/wat/ms4ds/terenfunkcje/nmt/NMTReader.java
Normal file
58
src/main/java/pl/wat/ms4ds/terenfunkcje/nmt/NMTReader.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package pl.wat.ms4ds.terenfunkcje.nmt;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class NMTReader {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// File dir = new File(System.getProperty("user.home") + "/nmt/gugik_SkorowidzNMT2018.gml");
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
File file = new File("C:/Workspace/nmt/N-34-139-A-b-2-4.asc");
|
||||
is = new FileInputStream(file);
|
||||
readFromInputStream(is);
|
||||
//...
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void readFromInputStream(InputStream inputStream) throws IOException {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
|
||||
String line= br.readLine();
|
||||
String[] split = line.split(" ");
|
||||
int ncols = Integer.parseInt(split[1]);
|
||||
line= br.readLine();
|
||||
split = line.split(" ");
|
||||
int nrows = Integer.parseInt(split[1]);
|
||||
line= br.readLine();
|
||||
split = line.split(" ");
|
||||
double xll = Double.parseDouble(split[1]);
|
||||
line= br.readLine();
|
||||
split = line.split(" ");
|
||||
double yll = Double.parseDouble(split[1]);
|
||||
line= br.readLine();
|
||||
split = line.split(" ");
|
||||
double cellsize = Double.parseDouble(split[1]);
|
||||
line= br.readLine();
|
||||
split = line.split(" ");
|
||||
double nodata = Double.parseDouble(split[1]);
|
||||
while ((line = br.readLine()) != null) {
|
||||
split = line.split(" ");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user