33import java .io .Closeable ;
44import java .io .File ;
55import java .io .IOException ;
6+ import java .nio .charset .Charset ;
67import java .util .Enumeration ;
78import java .util .Iterator ;
89
910import org .apache .commons .compress .archivers .zip .ZipArchiveEntry ;
1011import org .apache .commons .compress .archivers .zip .ZipFile ;
1112import org .codehaus .plexus .components .io .resources .AbstractPlexusIoArchiveResourceCollection ;
13+ import org .codehaus .plexus .components .io .resources .EncodingSupported ;
1214import org .codehaus .plexus .components .io .resources .PlexusIoResource ;
1315
1416public class PlexusIoZipFileResourceCollection
15- extends AbstractPlexusIoArchiveResourceCollection
17+ extends AbstractPlexusIoArchiveResourceCollection implements EncodingSupported
1618{
1719
1820 /**
1921 * The zip file resource collections role hint.
2022 */
2123 public static final String ROLE_HINT = "zip" ;
2224
25+ private Charset charset = Charset .forName ( "UTF-8" );
26+
2327 protected Iterator <PlexusIoResource > getEntries ()
2428 throws IOException
2529 {
@@ -28,7 +32,7 @@ protected Iterator<PlexusIoResource> getEntries()
2832 {
2933 throw new IOException ( "The tar archive file has not been set." );
3034 }
31- final ZipFile zipFile = new ZipFile ( f );
35+ final ZipFile zipFile = new ZipFile ( f , charset . name () );
3236 return new CloseableIterator ( zipFile );
3337 }
3438
@@ -68,5 +72,8 @@ public void close()
6872 }
6973 }
7074
71- ;
75+ public void setEncoding ( Charset charset )
76+ {
77+ this .charset = charset ;
78+ }
7279}
0 commit comments