Package java.util.zip

Examples of java.util.zip.ZipEntry


   *
   * @param entry File/Entry to load
   * @return InputStream of specific Entry
   */
  protected InputStream getInputStream(String entry) {
    ZipEntry zipEntry = mZipFileEntries.get(entry);
    try {
      return new JarFile(getBase()).getInputStream(zipEntry);
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here


                        entryName = entryName.substring(1);
                    }
                    if (!entryName.startsWith("/")) {
                        entryName = "/" + entryName;
                    }
                    ZipEntry entry = new ZipEntry(basePath + entryName);
                    zipOut.putNextEntry(entry);
                    InputStream in = null;
                    try {
                        in = new FileInputStream(fileName);
                        IOUtils.copyAndCloseInput(in, zipOut);
View Full Code Here

   * @param image get this Image
   * @return Image
   */
  protected ImageIcon getImageFromTheme(String image) {
    try {
      ZipEntry zipEntry = mZipFileEntries.get(image);
      InputStream in = new JarFile(getBase()).getInputStream(zipEntry);

      //  Create the byte array to hold the data
      byte[] bytes = new byte[(int)zipEntry.getSize()];
      //  Read in the bytes
      int offset = 0;
      int numRead = 0;
      while (offset < bytes.length
             && (numRead=in.read(bytes, offset, bytes.length-offset)) >= 0) {
View Full Code Here

                return true;
            }
            ZipFile file = openZipFile(fileName);
            Enumeration<? extends ZipEntry> en = file.entries();
            while (en.hasMoreElements()) {
                ZipEntry entry = en.nextElement();
                String n = entry.getName();
                if (n.equals(entryName)) {
                    return entry.isDirectory();
                } else  if (n.startsWith(entryName)) {
                    if (n.length() == entryName.length() + 1) {
                        if (n.equals(entryName + "/")) {
                            return true;
                        }
View Full Code Here

    }

    public long length(String fileName) {
        try {
            ZipFile file = openZipFile(fileName);
            ZipEntry entry = file.getEntry(getEntryName(fileName));
            return entry == null ? 0 : entry.getSize();
        } catch (IOException e) {
            return 0;
        }
    }
View Full Code Here

            String dirName = getEntryName(path);
            String prefix = path.substring(0, path.length() - dirName.length());
            Enumeration<? extends ZipEntry> en = file.entries();
            ArrayList<String> list = New.arrayList();
            while (en.hasMoreElements()) {
                ZipEntry entry = en.nextElement();
                String name = entry.getName();
                if (!name.startsWith(dirName)) {
                    continue;
                }
                if (name.length() <= dirName.length()) {
                    continue;
View Full Code Here

        return new FileObjectInputStream(file);
    }

    public FileObject openFileObject(String fileName, String mode) throws IOException {
        ZipFile file = openZipFile(translateFileName(fileName));
        ZipEntry entry = file.getEntry(getEntryName(fileName));
        if (entry == null) {
            throw new FileNotFoundException(fileName);
        }
        return new FileObjectZip(file, entry);
    }
View Full Code Here

        zipFile = new ZipFile(zip);

        entries = zipFile.entries();

        while (entries.hasMoreElements()) {
            ZipEntry entry = (ZipEntry) entries.nextElement();

            if (entry.isDirectory()) {
                (new File(dest, entry.getName())).mkdirs();
                continue;
            }

            copyInputStream(zipFile.getInputStream(entry),
                    new BufferedOutputStream(new FileOutputStream(new File(dest, entry.getName()))));
        }
        zipFile.close();
    }
View Full Code Here

        IOException ioe = null;

        try {
            dest = new FileOutputStream(sDstFileName + ZIP);
            out = new ZipOutputStream(new BufferedOutputStream(dest));
            ZipEntry entry = new ZipEntry(sDstFileName);
            out.putNextEntry(entry);

            bis = new BufferedInputStream(new FileInputStream(sSrcFileName), nBufferSize);
            bis.skip(lStart);
View Full Code Here

        IOException ioe = null;
        byte[] data = null;
        try {
            zipFile = new ZipFile(sSrcFileName + ZIP);
            Enumeration e = zipFile.entries();
            ZipEntry entry = null;
            if (e.hasMoreElements()) {
                entry = (ZipEntry) e.nextElement();
            }
            bis = new BufferedInputStream(zipFile.getInputStream(entry));
View Full Code Here

TOP

Related Classes of java.util.zip.ZipEntry

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.