Ahoj,

implementacia v Jave nepredpoklada, ze kodovanie nazvov suborov je v cp852 (co v nasom regione je), takze to shavaruje. Musis si spravit vlastne ZipInputStream a ZipOutputStream (+nejake dalsie aby to cele fungovalo) podla zdrojakov a tie upravit tak, aby:
fileName = new String(b, 0, len, "Cp852");

Radovana Straube  wrote / napĂ­sal(a):
Dobry den,

ked zipujem subory (pouzivam standarny java.util.zip a
JDK 1.5), ktore maju v nazvoch diakritiku, vo
vyslednom zip-e su nazvy suborov v zlom kodovani. Nic rozumneho som nevygooglila. Riesil uz niekto
podobny problem?

Dakujem
Radovana Straube

P.S. Pripajam aj metodu, ktorou pouzivam na zipovanie

/**
     * Compress a directory
     * @param _sSourceDir a source directory
     * @return a path to an archive
     */
    private String compressDir(String _sSourceDir)
throws IOException {
        
        // These are the files to include in the ZIP file
        String[] sFilenames = new File(_sSourceDir).list();
        
        // Create a buffer for reading the files
        byte[] byBuf = new byte[1024];
        
        // Create the ZIP file
        String sZipArchive = extractArchiveName(_sSourceDir);
        ZipOutputStream out = new ZipOutputStream(new
FileOutputStream(sZipArchive));
        
        // Compress the files
        for (int i = 0; i < sFilenames.length; i++) {
            FileInputStream in = new
FileInputStream(_sSourceDir + sFilenames[i]);
// Add ZIP entry to output stream.
            out.putNextEntry(new ZipEntry(sFilenames[i]));
// Transfer bytes from the file to the ZIP file
            int iLen;
            while ((iLen = in.read(byBuf)) > 0) {
                out.write(byBuf, 0, iLen);
            }
// Complete the entry
            out.closeEntry();
            in.close();
        }
        
        // Complete the ZIP file
        out.close();
        
        return sZipArchive;
    }


____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow


--
jeeff

Odpovedet emailem