我正在尝试使用java读取RINEX文件。我能想出的内容显示在下面的代码中。我只是设法读取rinex文件的标题部分。但由于rinex文件是数千行,我不认为我可以使用我在下面的代码中使用的方法读取所有这些。 有没有其他方法来读取rinex文件。
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gnssproject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.time.*;
import java.lang.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.text.SimpleDateFormat;
import javafx.scene.shape.Path;
/**
*
* @author robel
*/
public class readRinexNavAll {
private static Scanner x;
int ieph;
int sv;
int MAX_CHAR = 100;
char[] str = new char[MAX_CHAR];
String[] tmp = new String[20];
Calendar t;
Calendar g;
Calendar g0;
double dt;
int flags = 0x0;
public static void open() {
try {
x = new Scanner(new File("brdc3540.14n"));
System.out.println("file found");
} catch (Exception e) {
System.out.println("could not find file");
}
}
public static void readFile() {
while (x.hasNext()) {
String a = x.next();
String b = x.next();
String c = x.next();
String d = x.next();
String e = x.next();
String f = x.next();
String g = x.next();
String h = x.next();
String i = x.next();
String j = x.next();
String k = x.next();
String l = x.next();
String m = x.next();
String n = x.next();
String o = x.next();
String p = x.next();
String q = x.next();
String r = x.next();
String s = x.next();
String t = x.next();
String u = x.next();
String v = x.next();
String w = x.next();
String xx = x.next();
String y = x.next();
String z = x.next();
String aa = x.next();
String bb = x.next();
String cc = x.next();
String dd = x.next();
String ee = x.next();
String ff = x.next();
String gg = x.next();
String hh = x.next();
String ii = x.next();
String jj = x.next();
String kk = x.next();
String ll = x.next();
String mm = x.next();
String nn = x.next();
String oo = x.next();
String pp = x.next();
String qq = x.next();
System.out.printf("%s %s %s %s %s %s %s %s %s\n", a, b, c, d, e, f, g, h, i);
//Read header lines
if ("NAVIGATION".equals(b)) {
System.out.println("correct");
// tmp[] = b;
} else {
System.out.println("not the same");
}
////////////////////// ION ALPHA ///////////////////////
System.out.println("ION ALPHA");
char charArray[] = new char[15];
y.getChars(0, 10, charArray, 0);
replaceExpDesignator.replaceEwithD(charArray, 10);
for (char character : charArray) {
//System.out.println(character);
char alpha0;
alpha0 = character;
//System.out.println(alpha0);
System.out.print(alpha0);
}
System.out.println();
char charArray1[] = new char[15];
z.getChars(0, 10, charArray1, 0);
replaceExpDesignator.replaceEwithD(charArray1, 10);
for (char ccharacter : charArray1) {
//System.out.println(character);
char alpha1;
alpha1 = ccharacter;
//System.out.println(alpha0);
System.out.print(alpha1);
}
System.out.println();
char charArray2[] = new char[15];
aa.getChars(0, 11, charArray2, 0);
replaceExpDesignator.replaceEwithD(charArray2, 10);
for (char ccharacter : charArray2) {
//System.out.println(character);
char alpha2;
alpha2 = ccharacter;
//System.out.println(alpha0);
System.out.print(alpha2);
}
System.out.println();
char charArray3[] = new char[15];
bb.getChars(0, 10, charArray3, 0);
replaceExpDesignator.replaceEwithD(charArray3, 10);
for (char ccharacter : charArray3) {
//System.out.println(character);
char alpha3;
alpha3 = ccharacter;
//System.out.println(alpha0);
System.out.print(alpha3);
}
System.out.println();
////////////////////// ION BETA ///////////////////////
System.out.println("ION BETA");
char charArray4[] = new char[15];
ee.getChars(0, 10, charArray4, 0);
replaceExpDesignator.replaceEwithD(charArray4, 10);
for (char character : charArray4) {
//System.out.println(character);
char beta0;
beta0 = character;
//System.out.println(alpha0);
System.out.print(beta0);
}
System.out.println();
char charArray5[] = new char[15];
ff.getChars(0, 11, charArray5, 0);
replaceExpDesignator.replaceEwithD(charArray5, 10);
for (char ccharacter : charArray5) {
//System.out.println(character);
char beta1;
beta1 = ccharacter;
//System.out.println(alpha0);
System.out.print(beta1);
}
System.out.println();
char charArray6[] = new char[15];
gg.getChars(0, 11, charArray6, 0);
replaceExpDesignator.replaceEwithD(charArray6, 10);
for (char ccharacter : charArray6) {
//System.out.println(character);
char beta2;
beta2 = ccharacter;
//System.out.println(alpha0);
System.out.print(beta2);
}
System.out.println();
char charArray7[] = new char[15];
hh.getChars(0, 10, charArray7, 0);
replaceExpDesignator.replaceEwithD(charArray7, 10);
for (char ccharacter : charArray7) {
//System.out.println(character);
char beta3;
beta3 = ccharacter;
//System.out.println(alpha0);
System.out.print(beta3);
}
System.out.println();
////////////////////// DELTA UTC ///////////////////////
System.out.println("DELTA UTC");
char charArray8[] = new char[20];
kk.getChars(0, 18, charArray8, 0);
replaceExpDesignator.replaceEwithD(charArray8, 0);
for (char character : charArray8) {
//System.out.println(character);
char A0;
A0 = character;
//System.out.println(alpha0);
System.out.print(A0);
}
System.out.println();
char charArray9[] = new char[20];
ll.getChars(0, 18, charArray9, 0);
replaceExpDesignator.replaceEwithD(charArray9, 10);
for (char ccharacter : charArray9) {
//System.out.println(character);
char A1;
A1 = ccharacter;
//System.out.println(alpha0);
System.out.print(A1);
}
System.out.println();
char charArray10[] = new char[15];
mm.getChars(0, 5, charArray10, 0);
replaceExpDesignator.replaceEwithD(charArray10, 10);
for (char ccharacter : charArray10) {
//System.out.println(character);
char A2;
A2 = ccharacter;
//System.out.println(alpha0);
System.out.print(A2);
}
System.out.println();
char charArray11[] = new char[15];
nn.getChars(0, 4, charArray11, 0);
replaceExpDesignator.replaceEwithD(charArray11, 10);
for (char ccharacter : charArray11) {
//System.out.println(character);
char A3;
A3 = ccharacter;
//System.out.println(alpha0);
System.out.print(A3);
}
System.out.println();
////////////////////// LEAP SECONDS ///////////////////////
System.out.println("LEAP SECONDS");
char charArray12[] = new char[3];
qq.getChars(0, 2, charArray12, 0);
replaceExpDesignator.replaceEwithD(charArray12, 0);
for (char character : charArray12) {
//System.out.println(character);
char dtls;
dtls = character;
//System.out.println(alpha0);
System.out.print(dtls);
}
System.out.println();
break;
}
}
public static void closeFile() {
x.close();
}
}