Package java.util.zip

Examples of java.util.zip.ZipInputStream.closeEntry()


        boolean foundWebHome = false;
        boolean foundResources = false;

        // We must read the full stream as otherwise if we close it before we've fully read it
        // then the server side will get a broken pipe since it's still trying to send data on it.
        for (ZipEntry entry; (entry = zis.getNextEntry()) != null; zis.closeEntry()) {
            if (entry.getName().equals("xwiki.Main.WebHome.html")) {
                String content = IOUtils.toString(zis);

                // Verify that the content was rendered properly
                assertTrue("Should have contained 'Welcome to your wiki'", content.contains("Welcome to your wiki"));
View Full Code Here


                    if (!newNode.mkdir())
                        throw new IOException("Failed to extract dir '"
                                + entry.getName() + "' from 'data.zip' file");
                    log.debug("Extracted dir '" + entry.getName() + "' to '"
                            + newNode.getAbsolutePath() + "'");
                    zipStream.closeEntry();
                    continue;
                }
                fileSize = entry.getSize();
                fileStream = new FileOutputStream(newNode);
                try {
View Full Code Here

                    }
                    fileStream.flush();
                } finally {
                    fileStream.close();
                }
                zipStream.closeEntry();
                if (bytesRead != fileSize)
                    throw new IOException("Expected " + fileSize
                            + " bytes for '" + entry.getName()
                            + ", but extracted " + bytesRead + " bytes to '"
                            + newNode.getAbsolutePath() + "'");
View Full Code Here

                  while ((n = zipinputstream.read(buf, 0, 1024)) > -1) {
                      fileoutputstream.write(buf, 0, n);
                  }

                  fileoutputstream.close();
                  zipinputstream.closeEntry();
                  zipentry = zipinputstream.getNextEntry();

              }//while

                zipinputstream.close();
View Full Code Here

        // FIXME ASC performance? of this alternative soln.
        int size = (int) entry.getSize();
        ClassParser parser = new ClassParser(new ByteArrayInputStream(FileUtil.readAsByteArray(inStream)), entry.getName());
        JavaClass jc = parser.parse();
        inStream.closeEntry();

        ResolvedType type = world.addSourceObjectType(jc, false).getResolvedTypeX();
        type.setBinaryPath(inFile.getAbsolutePath());
        if (type.isAspect()) {
          addedAspects.add(type);
View Full Code Here

                ZipEntry entry = zis.getNextEntry();
                if (entry == null) {
                    break;
                }
                if (entry.isDirectory() || !entryName.equals(entry.getName())) {
                    zis.closeEntry();
                    continue;
                }
                InputStream fis = null;
                OutputStream fos = null;
                try {
View Full Code Here

                    }
                }
                if (deleteCopy) {
                    to.deleteOnExit();
                }
                zis.closeEntry();
                break;
            }
        } finally {
            if (zis != null) {
                try {
View Full Code Here

                    DocumentBuilder builder = factory.newDocumentBuilder();
                    doc = builder.parse(in);
                    in.close();
                    in = null;
                    break;
                } else in.closeEntry();
            }
        } catch (ParserConfigurationException e) {
            log.error("Unable to read META-INF/ra.xml in RAR file '"+data.getRaURI()+"'", e);
        } catch (SAXException e) {
            log.error("Unable to read META-INF/ra.xml in RAR file '"+data.getRaURI()+"'", e);
View Full Code Here

                                os.write(buffer, 0, count);
                            }
                        } finally {
                            os.close();
                        }
                        zis.closeEntry();
                    }
                }
            }
        } catch (IOException e) {
            delete(to);
View Full Code Here

                assertEquals("Unexpected log file content", logContent, baos.toString());

                ze = zis.getNextEntry();
            }

            zis.closeEntry();
            zis.close();

        }
        finally
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.