Editando arquivo texto

0 respostas
V

Olá,

Como faço para abrir um arquivo texto local;

Procurar por um parâmentro dentro dele, por exemplo:

<-- begin -->

<-- end -->

E escrever algo entre eles.

Por último, salvar.

Eu estava fazendo assim:

//try {
            //File indexFile = new File(presDir, "index.smil");
            //BufferedReader in = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/index.smil")));
            //PrintStream out = new PrintStream(this.workDir + File.separator + this.presentationName + File.separator + "index1.smil");
            
            
            
            //String s = null;
            //do {
            //    s = in.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);
            
            //in.close();            
            //out.close();            
            
        //} catch(IOException e) {
        //    Log.error("Error when writing slide sequence to SMIL file", e);
        //}

Vinicius.

Criado 16 de agosto de 2006
Respostas 0
Participantes 1