Code Search for Developers
 
 
  

TarAdapter.java from Kneobase at Krugle


Show TarAdapter.java syntax highlighted

/*
 * Created on 01/11/2004
 *
 */
package com.kneobase.driver.tar;

import java.io.IOException;

import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarInputStream;

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

/**
 * @author Ernesto De Santis
 *
 */
public class TarAdapter extends A_CompressedCompositeAdapter {
    
    private TarInputStream tarInputStream;
    
    public TarAdapter(I_ContentUnit cu) throws IOException{
        super(cu);
        tarInputStream = new TarInputStream(cu.getBodyInputStream());
    }

    public TarInputStream getTarInputStream() throws IOException {
        return tarInputStream; 
    }
    
    public Object getNextEntryAdapter() throws IOException {
        TarEntry entry = getTarInputStream().getNextEntry();
        if(entry != null)
            return new TarEntryAdapter(entry, this);
        else {
            freeResources();
            return null;
        }
    }

    public void freeResources(){
        try {
            getTarInputStream().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

  TarAdapter.java
  TarEntryAdapter.java