Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- truncaArchivoDespuesDe("<body>");
- public void truncaArchivoDespuesDe(String etiqueta) throws IOException {
- RandomAccessFile raf = new RandomAccessFile("ArchivoDescargado.html","rw");
- String linea = raf.readLine();
- while (linea != null) {
- if (linea.equals(etiqueta)) {
- raf.setLength(raf.getFilePointer()); //aqui truncamos el archivo a su
- // nuevo tamaño que será el de la posición
- // actual (en el siguiente renglón de la etiqueta encontrada)
- return;
- }
- linea = raf.readLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement