Article View: es.comp.lenguajes.java
Article #29243Re: Destruir Objetos.
From: Juan Pedro Barbancho Manchon
Date: Mon, 02 Feb 1998 00:00
Date: Mon, 02 Feb 1998 00:00
146 lines
5643 bytes
5643 bytes
Hola a todos,
Veo que solo dos han respondido, que poco compa�erismo. Como minimo me
tenias que haber fusilado ya que a mi tambien me parecio que Juan
Gonzalo decia algo interesante, pero como Juan Carlos es mi compa�ero de
grupo yo sabia lo que estaba preguntando.
Francesc Roig i Feliu wrote:
> Ante todo, permiteme decirte que me siento muy honrado de poder hablar
>
> con alguien tan experto en la materia que sabe cuanta gente dice lo
> que
> sabe, y cuanta lo que no sabe.
>
> No estoy de acuerdo! A mi, la opinion de Juan Gonzalo, si me ha
> interesado; y no creo que este escrito en ningun sitio que en las news
>
> no se pudan dar opiniones, siempre i cuando sean de temas relacionados
>
> por supuesto.
>
Por supuesto que se pueden dar opiniones, pero no es mejor que nos
dediquemos a resolvernos dudas unos a otros en lugar de tanto opinar.
> Personalmente, creo que cada cual es libre de dar su opinion de lo
> que
> el cree que sucede. Yo no soy ningun experto en Java e ignoro si lo
> que
> ha comentado Juan Gonzalo es totalmente cierto o no, pero creo que es
> coherente y que puede ser de interes para el grupo. Si tu crees que lo
>
> que ha dicho Juan Gonzalo no es correcto, lo que deberias hacer es
> aclararnoslo a todos en vez de meterte con el, que eso si que no ayuda
>
> nada.
>
> ... si lo supiera perfectamente, no creo que lo hubiese preguntado.
> No
> crees?
>
Yo creo que la pregunta fue hay una forma mejor, por supuesto que si a
los demas e incluso a mi, Juan Gonzalo nos ha resuelto dudas sobre el
gc, bienvenido, aunque podria haber titulado su news como GC FAQ o algo
parecido.
> Me alegro que al final nos hayas contado algo util relacionado con
> Java
Intentare la proxima vez escribiros algo interesante sobre Java. Para
que nbo os cabreeis os mando un JUnzip, por supuesto puede hacerse
mejor.
import java.io.*;
import java.util.zip.*;
import java.security.*;
import java.util.Enumeration;
class zip{
static FileInputStream fis;
public static void main(String[] args) {
try {
ZipFile zip = new ZipFile(args[0]);
for (Enumeration e = zip.entries() ; e.hasMoreElements() ;)
{
ZipEntry zipfile = (ZipEntry) e.nextElement();
System.out.println("Inicio");
System.out.println("Comment" + zipfile.getComment());
// Returns the comment string for the entry, or null if none.
System.out.println("Compresed" + zipfile.getCompressedSize() );
// Returns the compressed size of the entry data, or -1 if not known.
System.out.println("CRC" + zipfile.getCrc() );
// Returns the CRC-32 checksum of the uncompressed entry data, or -1 if
not known.
System.out.println("Extra" + zipfile.getExtra() );
// Returns the extra field data for the entry, or null if none.
System.out.println("Method" + zipfile.getMethod() );
// Returns the compression method of the entry, or -1 if not specified.
System.out.println("Name" + zipfile.getName());
// Returns the name of the entry.
System.out.println("Size" + zipfile.getSize());
// Returns the uncompressed size of the entry data, or -1 if not known.
System.out.println("Time" + zipfile.getTime());
// Returns the modification time of the entry, or -1 if not specified.
System.out.println("Dir" + zipfile.isDirectory());
// Returns true if this is a directory entry.
if(! zipfile.isDirectory()){
String dirname = zipfile.getName();
dirname =
dirname.replace('/',System.getProperties().getProperty("file.separator",
null).charAt(0));
File directorio = new File(dirname);
System.out.println("Fin " + directorio.getParent());
dirname = directorio.getParent();
if (dirname != null)
{
directorio = new File(dirname);
if(! directorio.mkdirs())
System.out.println("Errores" + dirname);
}
InputStream fin = zip.getInputStream(zipfile);
FileOutputStream fous = new
FileOutputStream(zipfile.getName());
byte b;
while (fin.available() != 0){
b = (byte) fin.read();
fous.write( b);
};
fin.close();
}else{
String dirname = zipfile.getName();
dirname = dirname.substring(0,dirname.length()-1);
dirname =
dirname.replace('/',System.getProperties().getProperty("file.separator",
null).charAt(0));
File directorio = new File(dirname);
if(! directorio.mkdirs())
System.out.println("Errores" + dirname);
}
}
zip.close();
// fous.close();
}catch (Exception e){
System.err.println("Caught exception " + e.toString());
}
}
}
Esto es simplemente como prueba de mi arrepentimiento, por cierto, una
mala tarde la tiene cualquiera.
Saludos
--
--------------------------------------------------
Nombre y apelllidos:
Juan Pedro Barbancho Manch�n
Organizaci�n:
CTI
http://www.uco.es/grupos/cti
E-mail:
ct2bamaj@uco.es
Java Senior Programmer
Technical Details
Message-ID:
<34D5AD74.834FA431@uco.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34C5E749.FC9CFAC1@uco.es> <34C5EC1E.96ABA68D@uco.es> <34CFB713.48DC1B10@caymasa.es> <34D05B17.6FBF9024@uco.es> <34D1E535.820AC231@arrakis.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: 1116f3,f707b665c21e869f X-Google-Attributes: gid1116f3,public From: Juan Pedro Barbancho Manchon <ct2bamaj@uco.es> Subject: Re: Destruir Objetos. Date: 1998/02/02 Message-ID: <34D5AD74.834FA431@uco.es> X-Deja-AN: 321359085 Content-Transfer-Encoding: 8bit References: <34C5E749.FC9CFAC1@uco.es> <34C5EC1E.96ABA68D@uco.es> <34CFB713.48DC1B10@caymasa.es> <34D05B17.6FBF9024@uco.es> <34D1E535.820AC231@arrakis.es> X-Priority: 3 (Normal) Content-Type: text/plain; charset=iso-8859-1 Organization: CTI Mime-Version: 1.0 Newsgroups: es.comp.lenguajes.java