Package java.util.zip

Examples of java.util.zip.ZipEntry


        RandomAccessFile out = null;
        ZipFile zipFile = 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));
            bis.skip(lStart);
View Full Code Here


  }

  private ZipEntry getEntry( final int index ) {
    ensureDocumentIndex( index );
    ensureZipFile();
    final ZipEntry entry = zipFile.getEntry( Integer.toString( index ) );
    if ( entry == null ) throw new NoSuchElementException( "Failure retrieving entry " + index );
    return entry;
  }
View Full Code Here

    if ( entry == null ) throw new NoSuchElementException( "Failure retrieving entry " + index );
    return entry;
  }
 
  public Document document( final int index ) throws IOException {
    final ZipEntry entry = getEntry( index );
    final Reference2ObjectMap<Enum<?>,Object> metadata = metadata( index, entry );
    InputStream is = zipFile.getInputStream( entry );
    return factory.getDocument( is, metadata );
  }
View Full Code Here

  public Reference2ObjectMap<Enum<?>,Object> metadata( final int index ) {
    return metadata( index, null );
  }
 
  public InputStream stream( final int index ) throws IOException {
    final ZipEntry entry = getEntry ( index );
    entry.getComment(); // Just skip title
    InputStream is = zipFile.getInputStream( entry );
    return is;
  }
View Full Code Here

        return new AbstractDocumentIterator() {
          final Reference2ObjectArrayMap<Enum<?>,Object> metadata = new Reference2ObjectArrayMap<Enum<?>,Object>( new Enum[ 1 ], new Object[ 1 ] );

          ZipInputStream zis = new ZipInputStream( new FileInputStream( zipFile.getName() ) );
          public Document nextDocument() throws IOException {
            ZipEntry entry;
            String name;
            do {
              entry = zis.getNextEntry();
              if ( entry == null ) return null;
              name = entry.getName();
            } while ( !Character.isDigit( name.charAt( 0 ) ) )
            String title = entry.getComment();
            if ( DEBUG ) LOGGER.debug( "Reading sequentially document " + title + ", name: " + entry.getName() );
            InputStream is = zipFile.getInputStream( entry );
            metadata.put( MetadataKeys.TITLE, title );
            return factory.getDocument( is, metadata );
          }
        };
View Full Code Here

    IOUtils.closeQuietly( nonTermsOutputStream );
    documentOffsetsObs.close();
    termOffsetsObs.close();
    if ( nonTermOffsetsObs != null ) nonTermOffsetsObs.close();
    if ( hasNonText ) {
      if ( documents == 0 ) nonTextZipOutputStream.putNextEntry( new ZipEntry( "dummy" ) );
      nonTextZipDataOutputStream.close();
    }

    final SimpleCompressedDocumentCollection simpleCompressedDocumentCollection = new SimpleCompressedDocumentCollection( basenameSuffix, documents, terms.size(), nonTerms != null ? nonTerms.size() : -1, exact, factory );
    BinIO.storeObject( simpleCompressedDocumentCollection, basenameSuffix + DocumentCollection.DEFAULT_EXTENSION );
View Full Code Here

  public void startDocument( CharSequence title, CharSequence uri ) throws IOException {
    documentsOutputBitStream.writtenBits( 0 );
    bitsForUris += writeSelfDelimitedUtf8String( documentsOutputBitStream, uri == null ? "" : uri );
    bitsForTitles += writeSelfDelimitedUtf8String( documentsOutputBitStream, title );
    if ( hasNonText ) {
      final ZipEntry currEntry = new ZipEntry( Integer.toString( documents ) );
      nonTextZipOutputStream.putNextEntry( currEntry );

    }
    documents++;
  }
View Full Code Here

        for (File jf : jarFiles) {
            try {
                ZipFile zf = new ZipFile(jf);
                Enumeration<? extends ZipEntry> entries = zf.entries();
                while (entries.hasMoreElements()) {
                    ZipEntry entry = entries.nextElement();
                    String name = entry.getName();
                   
                    if (name.endsWith(".class")) {
                        name = name.replaceAll("/", ".");
                        name = name.substring(0, name.lastIndexOf("."));
                        loadClass(name);
View Full Code Here

        ZipFile zf = null;
        try {
            zf = new ZipFile(jar);
            Enumeration<? extends ZipEntry> entries = zf.entries();
            while (entries.hasMoreElements()) {
                ZipEntry entry = entries.nextElement();
                if (entry.getName().equals(name)) {
                    bis = new BufferedInputStream(zf.getInputStream(entry));
                    int size = (int) entry.getSize();
                    byte[] data = new byte[size];
                    int b = 0, eofFlag = 0;
                    while ((size - b) > 0) {
                        eofFlag = bis.read(data, b, size - b);
                        if (eofFlag == -1)
View Full Code Here

               
                Enumeration<? extends ZipEntry> list = zf.entries();
               
                client.notifyStarted(zf.size());
                while (list.hasMoreElements() && !canceled) {
                    ZipEntry ze = list.nextElement();
   
                    BufferedInputStream bis = new BufferedInputStream(zf.getInputStream(ze));
                    String name = ze.getName();
                   
                    client.notifyMessage(DcResources.getText("msgProcessingFileX", name));
                   
                    if (name.toLowerCase().endsWith(".xsl")) {
                        // directory name is contained in the name
                        writeToFile(bis, new File(DataCrow.reportDir, name));
                    } else if (name.toLowerCase().endsWith(".jpg")) {
                        String moduleName = name.substring(0, name.indexOf("_"));
                        Collection<DcImageIcon> c = icons.get(moduleName);
                        c = c == null ? new ArrayList<DcImageIcon>() : c;
                       
                        int size = (int) ze.getSize();
                        byte[] bytes = new byte[size];
                        bis.read(bytes);
                       
                        DcImageIcon icon = new DcImageIcon(bytes);
                        icon.setFilename(name.substring(name.indexOf("_") + 1));
View Full Code Here

TOP

Related Classes of java.util.zip.ZipEntry

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.