Bin gerade dabei ein paar relativ große Dateien aus zu lesen dabei bin ich mit der Performance unzufrieden jetzt stellt sich mir die Frage was genau ich falsch mache oder wo der Flaschenhals liegt.
Was ich auch gerne wissen würde ist weshalb bei Zeile 18 das Programm ohne Rückmeldung den Dienst quittiert...
Was ich auch gerne wissen würde ist weshalb bei Zeile 18 das Programm ohne Rückmeldung den Dienst quittiert...
Code:
public class Main
{
public static void main(String[] args) throws IOException
{
File file = new File("E:/Games/No Man's Sky/mod/NMSARC.1A1B4C22/MODELS/COMMON/SPACECRAFT/DRONE/DRONESHIP.GEOMETRY.MBIN.exml");
BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(file), "UTF8"));
GetVertices(in);
in.close();
}
private static void GetVertices(BufferedReader _in) throws IOException
{
String currentLin = "";
String result = "";
int count = 0;
//long totalLines = _in.lines().count(); program stops without error
String totalLines = "?";
int currentPosition = 0;
boolean gettingVertices = false;
while((currentLin = _in.readLine()) != null)
{
if(!gettingVertices && currentLin.equals(" <Property name=\"VertexStream\">"))
gettingVertices = true;
if(gettingVertices && currentLin.equals(" <Property name=\"SmallVertexStream\">"))
return;//string
if(gettingVertices)
{
currentLin = currentLin.replace(" <Property value=\"", "");
currentLin = currentLin.replace("\" />","");
if(count == 0)
result += " v";
result += " " + currentLin;
count ++;
}
if(count == 3)
{
count = 0;
result += "\n";
}
currentPosition ++;
if(currentPosition % 5000 == 0)
{
System.out.println("current line =" + currentPosition + "total lines = " + totalLines);
}
}
System.out.println(result);
}
}