Article View: es.comp.lenguajes.java
Article #27596Una manera mejor de copiar ficheros
From: Juan Pedro Barbancho Manch�n
Date: Fri, 07 Aug 1998 00:00
Date: Fri, 07 Aug 1998 00:00
25 lines
975 bytes
975 bytes
Hola,
Alguien conoce un algoritmo mejor para copiar un fichero
Los input and ouptstream derivan de Buffered input y outputstream
El codigo:
public void copy(InputStream in, OutputStream out) throws IOException
{
int i =0;
for (int b = in.read();b != -1; b=in.read())
{
out.write(b);
i++;
if(i==512){
setChanged();
notifyObservers(new Integer( 512));
i = 0;
}
}
setChanged();
notifyObservers(new Integer( i));
}
Gracias
JuanP
Technical Details
Message-ID:
<35CACB3E.6C3D834B@uco.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1116f3,1a8c4fe379e5732a,start X-Google-Attributes: gid1116f3,public From: "Juan Pedro Barbancho Manch�n" <ct2bamaj@uco.es> Subject: Una manera mejor de copiar ficheros Date: 1998/08/07 Message-ID: <35CACB3E.6C3D834B@uco.es> X-Deja-AN: 378795719 Content-Transfer-Encoding: 7bit To: ANAYA <java@anaya.es> Content-Type: text/plain; charset=us-ascii Organization: CTI Mime-Version: 1.0 Newsgroups: es.comp.lenguajes.java