Pessoal,
Tenho uma método que envia dados para serem escritos em um arquivo e outro método que pega esses dados e escreve.
Estou encontrando problema quando tento reescrever.
Método que envia os dados:
private void envia(java.awt.event.ActionEvent evt) {
for( int linha=0; linha<this.jTable1.getRowCount(); linha++){
String name = (String)this.jTable1.getModel().getValueAt(linha,0);
presentationRecorder = new PresentationRecorder();
presentationRecorder.createIndexSMILCode(name, linha);
}
}
Método que escreve:
public void createIndexSMILCode(String textFile, int linha) {
try {
FileReader reader = new FileReader("C:\Documents and Settings\vlima\Desktop\Teste do Gravador\t6\index.smil");
BufferedReader leitor = new BufferedReader(reader);
PrintStream out = new PrintStream("C:\Documents and Settings\vlima\Desktop\Teste do Gravador\t6\index1.smil");
String s = null;
do {
s = leitor.readLine();
if(s != null) {
if(s.trim().toLowerCase().startsWith("<!-- begin" + linha + " -->")) {
out.println("<href=\"" + textFile + ".smil\">");
continue;
} else if(s.trim().toLowerCase().startsWith("<!-- end" + linha + " -->")) {
continue;
}
out.println(s);
}
} while(s != null);
leitor.close();
reader.close();
out.close();
} catch(Exception e) {
Log.warning("Exception when trying to create SMIL code for presentation", e);
}
}//createIndexSMILCode
Do jeito que está, o método grava em outro arquivo e apenas o último dado enviado.
Como faço para manter no mesmo arquivo que abro e escrever todos os dados enviados?
Vinicius.