Boa tarde !!! Galera
Bom, mais uma vez preciso da ajuda de vcs
estou gerando um arquivo texto, de informações que pego de um banco de Dados
porem , eu preciso que quando o contador atingir 500 seja Criado um novo arquivo , exemplo
tenho um banco com 1000 Registro , o Primeiro arquivo tera 500 , e o segundo os 500 restante
segue uma parte do meu codigo que criei até agora
// Começo Cria e Abre arquivo Texto\.Txt Para Escrever *****************
// FileWriter para gerar arquivo
FileWriter writer = null;
try {
// writer = new FileWriter(new File(ArqSai.getText()+"."+Util.Padl(Integer.toString(SeqExt),3,"0")),true); // Este Adiciona em um arquivo já existente
writer = new FileWriter(new File(ArqSai.getText()+"."+Util.Padl(Integer.toString(SeqExt),3,"0"))); // Este Sobrescreve o arquivo existente
} catch (IOException ex) {
Logger.getLogger(Boleto.class.getName()).log(Level.SEVERE, null, ex);
}
// PrintWriter pra escrever no arquivo (em texto!)
// PrintWriter Fwrite = new PrintWriter(writer,true); // Este Adiciona em um arquivo já existente
PrintWriter Fwrite = new PrintWriter(writer); // Este Sobrescreve o arquivo existente
Fwrite.println("%!");
Fwrite.println("XGF");
Fwrite.println("500 SETBUFSIZE");
Fwrite.println("(PRINCIPAL.JDT) STARTLM");
// Final Cria e Abre arquivo Texto\.Txt Para Escrever *****************
try {
while(conexao.resultset.next()) { // Eof ou End Of File Enquando não for final de Arquivo
sequencia++;
SeqX++;
if(SeqX > Quebra ){
SeqX = 1;
SeqExt++ ;
Fwrite.println("%%EOF");
Fwrite.close();
try {
writer.close();
} catch (IOException ex) {
Logger.getLogger(Boleto.class.getName()).log(Level.SEVERE, null, ex);
}
}
caso alguem possa me ajudar
agradeço pela atenção
Att JavaX