Package org.apache.tools.zip

Examples of org.apache.tools.zip.ZipFile$Entry


  }

  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
View Full Code Here


    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

    log("doPut " + uri);
    if ("/".equals(uri.getPath())) {
      log("create bucket");
      bucket = true;
    } else {
      Entry e = new Entry(key(uri));
      e.setLastModified(new Date());
      e.setSize(req.getContentLength());
      e.setOwner(new Owner("id", "name"));
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ServletInputStream is = req.getInputStream();
      byte b[] = new byte[128];
      while (true) {
        int len = is.read(b);
View Full Code Here

        }

        AtomicBoolean stopFlag = new AtomicBoolean();

        try {
            ZipFile zip = new ZipFile(zipFile);
            try {
                // The iteration order of zip.getEntries() is based on the hash of the zip entry. This isn't much use
                // to us. So, collect the entries in a map and iterate over them in alphabetical order.
                Map<String, ZipEntry> entriesByName = new TreeMap<String, ZipEntry>();
                Enumeration entries = zip.getEntries();
                while (entries.hasMoreElements()) {
                    ZipEntry entry = (ZipEntry) entries.nextElement();
                    entriesByName.put(entry.getName(), entry);
                }
                Iterator<ZipEntry> sortedEntries = entriesByName.values().iterator();
                while (!stopFlag.get() && sortedEntries.hasNext()) {
                    ZipEntry entry = sortedEntries.next();
                    if (entry.isDirectory()) {
                        visitor.visitDir(new DetailsImpl(entry, zip, stopFlag));
                    } else {
                        visitor.visitFile(new DetailsImpl(entry, zip, stopFlag));
                    }
                }
            } finally {
                zip.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not expand %s.", this), e);
        }
View Full Code Here

            throw new BuildException("Source " + source.getClass().getName()
                                     + " not supported by this plugin");
        }
        InputStream inputStream = null;
        InputSource inputSource = null;
        ZipFile zf = null;

        try {
            /**
             * SAX 2 style parser used to parse the given file.
             */
            XMLReader parser = JAXPUtils.getNamespaceXMLReader();

            String uri = null;
            if (buildFile != null) {
                uri = FILE_UTILS.toURI(buildFile.getAbsolutePath());
                inputStream = new FileInputStream(buildFile);
            } else {
                uri = url.toString();
                int pling = -1;
                if (uri.startsWith("jar:file")
                    && (pling = uri.indexOf("!/")) > -1) {
                    zf = new ZipFile(org.apache.tools.ant.launch.Locator
                                     .fromJarURI(uri), "UTF-8");
                    inputStream =
                        zf.getInputStream(zf.getEntry(uri.substring(pling + 1)));
                } else {
                    inputStream = url.openStream();
                }
            }

View Full Code Here

            BufferedInputStream is;
            BufferedOutputStream dest;
            FileOutputStream fos;
            File nameForDirCreating;
            File destination = null;
            ZipFile zipfile;
            ZipEntry entry;
            ZipFile zipfile_test = new ZipFile(filename, consoleEnc);
            Enumeration e;
            InputStream entryStream;
            Boolean folderCreated = false;
            int BUFFER = 2048;
            int count;
            byte data[];

            // For first, check, what folder doesn't exist
            while (!folderCreated) {
                destinationFolder = Vars.Mater_Lector + "/"
                        + (new Date()).getTime() + "/";
                destination = new File(destinationFolder);
                if (destination.mkdirs()) {
                    folderCreated = true;
                }
            }

            if (zipfile_test.getEncoding() == null) {
                zipfile = new ZipFile(filename, consoleEnc);
            } else {
                zipfile = new ZipFile(filename, zipfile_test.getEncoding());
            }
            zipfile_test.close();

            e = zipfile.getEntries();
            while (e.hasMoreElements()) {
                entry = (ZipEntry) e.nextElement();
                fileName = entry.getName();
View Full Code Here

            String consoleEnc = System.getProperty("console.encoding", "Cp866");
            BufferedInputStream is;
            BufferedOutputStream dest;
            FileOutputStream fos;
            File nameForDirCreating;
            ZipFile zipfile;
            ZipEntry entry;
            ZipFile zipfile_test = new ZipFile(filename, consoleEnc);
            Enumeration e;
            InputStream entryStream;
            int BUFFER = 2048;
            int count;
            float countFiles = 0;
            float countProcessedFiles = 0;
            int countProgress;
            byte data[];
            FileOutputStream fosForXML;
            OutputFormat of;
            XMLSerializer serializer;
            Element XMLelement = null;
            Node XMLnode = null;
            // Document (Xerces implementation only).
            Document xmldoc = new DocumentImpl();
            // Root element.
            Element mainElement = xmldoc.createElement("mainElement");
            Element rootFilesForDeleting = xmldoc.createElement("filesForDeleting");
            Element rootDirsForDeleting = xmldoc.createElement("foldersForDeleting");
            Element mainDir = xmldoc.createElement("mainDir");
            SomeFunctionsForInstaller SomeFunctionsForInstaller = new SomeFunctionsForInstaller();
            Map<Integer, String> tmpfileNamesForShortcuts = new HashMap();
            ArrayList<Map> fileNamesForShortcuts = new ArrayList<Map>();
            SomeFunctionsForInstaller SomeFunctionsForInstallerLocal=new SomeFunctionsForInstaller();

            if (zipfile_test.getEncoding() == null) {
                zipfile = new ZipFile(filename, consoleEnc);
            } else {
                zipfile = new ZipFile(filename, zipfile_test.getEncoding());
            }
            zipfile_test.close();

            e = zipfile.getEntries();
            while (e.hasMoreElements()) {
                countFiles++;
                entry = (ZipEntry) e.nextElement();
View Full Code Here

            String consoleEnc = System.getProperty("console.encoding", "Cp866");
            BufferedInputStream is;
            BufferedOutputStream dest;
            FileOutputStream fos;
            File nameForDirCreating;
            ZipFile zipfile;
            ZipEntry entry;
            ZipFile zipfile_test = new ZipFile(filename, consoleEnc);
            Enumeration e;
            InputStream entryStream;
            int BUFFER = 2048;
            int count;
            float countFiles = 0;
            float countProcessedFiles = 0;
            int countProgress;
            byte data[];


            if (zipfile_test.getEncoding() == null) {
                zipfile = new ZipFile(filename, consoleEnc);
            } else {
                zipfile = new ZipFile(filename, zipfile_test.getEncoding());
            }
            zipfile_test.close();

            e = zipfile.getEntries();
            while (e.hasMoreElements()) {
                countFiles++;
                entry = (ZipEntry) e.nextElement();
View Full Code Here

TOP

Related Classes of org.apache.tools.zip.ZipFile$Entry

Copyright © 2018 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.