Package java.util.zip

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


            // Now we will extract the document and write it into a byte array
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte[] buffer = new byte[8192];
            int length;
            while (zipStream.available() > 0) {
                length = zipStream.read(buffer, 0, 8192);
                if (length > 0) {
                    baos.write(buffer, 0, length);
                }
            }
View Full Code Here


        ZipEntry entry = zis1.getNextEntry();
        assertNotNull("No entry in the archive.", entry);
        long entrySize = entry.getSize();
        assertTrue("Entry size was < 1", entrySize > 0);
        int i = 0;
        while (zis1.available() > 0) {
            zis1.skip(1);
            i++;
        }
        if (i != entrySize) {
            fail("ZipInputStream.available or ZipInputStream.skip does not " +
View Full Code Here

            fail("ZipInputStream.available or ZipInputStream.skip does not " +
                    "working properly. Only skipped " + i +
                    " bytes instead of " + entrySize);
        }
        assertEquals(0, zis1.skip(1));
        assertEquals(0, zis1.available());
        zis1.closeEntry();
        assertEquals(1, zis.available());
        zis1.close();
        try {
            zis1.available();
View Full Code Here

        assertEquals(0, zis1.available());
        zis1.closeEntry();
        assertEquals(1, zis.available());
        zis1.close();
        try {
            zis1.available();
            fail("IOException expected");
        } catch (IOException ee) {
            // expected
        }
    }
View Full Code Here

        // now we will extract the document and write it into a byte array
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[8192];
        int length = -1;
        while (zipStream.available() > 0) {
            length = zipStream.read(buffer, 0, 8192);
            if (length > 0) {
                baos.write(buffer, 0, length);
            }
        }
View Full Code Here

            final int bufferSize = 102400;
            final byte[] buffer = new byte[bufferSize];
            while (true) {
              final int len = zipFileStream.read(buffer);
              if (zipFileStream.available() == 0) {
                break;
              }
              os.write(buffer, 0, len);
            }
          } finally {
View Full Code Here

  private boolean findThemeDescriptor(File jarFile) throws MojoExecutionException {
    ZipInputStream zip = null;
    try {
      zip = new ZipInputStream(new FileInputStream(jarFile));
      while (zip.available() > 0) {
        ZipEntry nextEntry = zip.getNextEntry();
        if (nextEntry == null || nextEntry.isDirectory()) {
          continue;
        }
        String name = nextEntry.getName();
View Full Code Here

        // now we will extract the document and write it into a byte array
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[8192];
        int length = -1;
        while (zipStream.available() > 0) {
            length = zipStream.read(buffer, 0, 8192);
            if (length > 0) {
                baos.write(buffer, 0, length);
            }
        }
View Full Code Here

          os = new FileOutputStream(file);

          byte[] buffer = new byte[102400];
          while (true) {
            int len = zipFileStream.read(buffer);
            if (zipFileStream.available() == 0)
              break;
            os.write(buffer, 0, len);
          }
        } finally {
          if (null != os) {
View Full Code Here

  private InputStream getUnderlyingInputStream(InputStream inputStream, Map<?, ?> options) throws IOException
  {
    if (useZip() || (options != null && Boolean.TRUE.equals(options.get(Resource.OPTION_ZIP))))
    {
      ZipInputStream zipInputStream = new ZipInputStream(inputStream);
      while (zipInputStream.available() != 0)
      {
        ZipEntry zipEntry = zipInputStream.getNextEntry();
        if (isContentZipEntry(zipEntry))
        {
          return zipInputStream;
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.