Code Search for Developers
 
 
  

ZipAdapter.java from Kneobase at Krugle


Show ZipAdapter.java syntax highlighted

/*
 * Created on 26/10/2004
 *
 */
package com.kneobase.driver.zip;

import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import com.kneobase.driver.compressed.A_CompressedCompositeAdapter;
import com.kneobase.driver.content.I_ContentUnit;

/**
 * @author Ernesto De Santis
 *
 */
public class ZipAdapter extends A_CompressedCompositeAdapter{
    
    private ZipInputStream zipInputStream = null;
    
    public ZipAdapter(I_ContentUnit cu) throws IOException {
        super(cu);
    }

    public ZipInputStream getZipInputStream() throws IOException {
        if( zipInputStream == null ){
            zipInputStream =
                new ZipInputStream( getAdaptedContentUnit().getBodyInputStream() );
        }
        return zipInputStream; 
    }
    
    public Object getNextEntryAdapter() throws IOException {
        ZipEntry entry = getZipInputStream().getNextEntry();
        if(entry != null)
            return new ZipEntryAdapter(entry, this);
        else{
            freeResources();
            return null;
        }
    }

    public void freeResources(){
        try {
            getZipInputStream().close();
        } catch( IOException e ){
            // intentionally left blank
        }
    }

}




See more files for this project here

Kneobase

Kneobase is an enterprise search engine, based upon the Lucene search engine and the Spring framework. It allows to perform full-text search across many different content sources. It is highly adaptable out-of-the-box and has a pluggable architecture.

Project homepage: http://sourceforge.net/projects/kneobase
Programming language(s): Java,XML
License: other

  ZipAdapter.java
  ZipEntryAdapter.java