🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #740

Re: hola otra vez AHORA TENGO UNA DUDA SOBRE ARCHIVOS

#740
From: Carl
Date: Thu, 08 Feb 2007 21:05
30 lines
2659 bytes
On Feb 7, 12:01 pm, "omm79" <omm1...@gmail.com> wrote:
> HE LEIDO Y PROBADO MUCHOS EJEMPLOS DE JAVA SOBRE ARCHIVOS PERO TODAVIA
> NO HE ENCONTRADO UNA SOLUCION Y LA PREGUNTA ES COMO PUEDO LEER UN
> ARCHIVO DESDE UNA CARPETA X, ESCRIBIRLE TEXTO, GUARDARLO CON UN NOMBRE
> X, Y DESPUES MODIFICAR ESE ARCHIVO ES DECIR PODER METER CUALQUIER DATO
> DESPUES DE HABERLO CREADO CON TEXTO ANTERIOR O APENDIZAR MAS
> INFORMACION ES DECIR:
> SI CREO EL ARCHIVO X.TXT Y METO UNA CADENA "HOLA MUNDO" LO CIERRO Y
> DESPUES VUELVO A ABRIRLO PARA METER LA CADENA "ADIOS MUNDO" PERO SIN
> QUE SOBREESCRIBA EL ARCHIVO ES DECIR QUE QUEDEN LAS CADENAS DENTRO DEL
> ARCHIVO ASI:
> "HOLA MUNDO"
> "ADIOS MUNDO"
>
> Y SIN USAR MODOS GRAFICOS ES DECIR PURA LINEA DE COMANDO SE QUE ES MAS
> TEDIOSO PERO PUES ME PODRIA SER DE GRAN AYUDA QUE ME DIJERAN COMO
> HACER ESO, Y COMO LES ESCRIBO HE PROBADO MUCHOS EJEMPLOS PERO NO UNO
> QUE HAGA ESTO, PARA MI LO COMPLICADO SERIA QUE ABRIERA UN ARCHIVO QUE
> YA EXISTE Y LO MODIFICARA O PUDIERA METER MAS DATOS SIN PERDER LOS
> ANTERIORES, NUEVAMENTE ESTARIA MUY AGRADECIDO SI ME DAN ALGUNA IDEA DE
> COMO HACERLO, SALUDOS.

Hola,

Una opción:
Usando un RandomAccessFile es posible usar el metodo seek() junto con
length() para mover el "pointer" al final del archivo antes de añadir
los nuevos datos.

Carl.
Technical Details
Message-ID: <1170968707.010329.193880@s48g2000cws.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!s48g2000cws.googlegroups.com!not-for-mail
References: <1170878460.037457.19210@a34g2000cwb.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1116f3,4678e0c7f1ba29ae
X-Google-Attributes: gid1116f3,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!s48g2000cws.googlegroups.com!not-for-mail
From: "Carl" <c.groner@gmail.com>
Newsgroups: es.comp.lenguajes.java
Subject: Re: hola otra vez AHORA TENGO UNA DUDA SOBRE ARCHIVOS
Date: 8 Feb 2007 13:05:11 -0800
Organization: http://groups.google.com
Lines: 31
Message-ID: <1170968707.010329.193880@s48g2000cws.googlegroups.com>
References: <1170878460.037457.19210@a34g2000cwb.googlegroups.com>
NNTP-Posting-Host: 67.117.56.65
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1170968716 32572 127.0.0.1 (8 Feb 2007 21:05:16 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 8 Feb 2007 21:05:16 +0000 (UTC)
In-Reply-To: <1170878460.037457.19210@a34g2000cwb.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 WHITNEY
Complaints-To: groups-abuse@google.com
Injection-Info: s48g2000cws.googlegroups.com; posting-host=67.117.56.65;
   posting-account=M4zEWw0AAACNHKppx29kJq4w8DYbzmCI