Witam
Mam nastepujacy problem...mam do zapisania na dysku pewien indekser danych zawartych w bazie danych, posiadam pewien devloperski snapshot oryginalnej bazy i moje roziwaznie dziala do pewnego momentu, pobieram dane z bazy i w czasie zapisu do pliku
otrzymuje cos takiego :
Exception in thread "main" java.io.IOException: Insufficient system resources exist to complete the requested service
Funkcja zapisujaca dane do plikow w odpowiedniej strukturze wyglada nastepujaca:
public void writeMorton(final String path, final MortonData data) throws IOException {
File mortonfile = new File(path);
final PrintStream ps;
if (mortonfile.exists()) {
ps = new PrintStream(new FileOutputStream(mortonfile, true));
ps.println(data.toString());
ps.close();
} else {
File parentCatalouge = mortonfile.getParentFile();
if(parentCatalouge.exists()){
mortonfile.createNewFile();
}else{
parentCatalouge.mkdirs();
mortonfile.createNewFile();
}
ps = new PrintStream(new FileOutputStream(mortonfile,true));
ps.print(data.toString());
ps.close();
}
}
Czy da sie to jakos zoptymalizowac lub obejsc ten problem?