org.teiid.internal.core.index
Class BlocksIndexOutput

java.lang.Object
  extended by org.teiid.internal.core.index.IndexOutput
      extended by org.teiid.internal.core.index.BlocksIndexOutput

public class BlocksIndexOutput
extends IndexOutput

A blocksIndexOutput is used to save an index in a file with the given structure:
- Signature of the file;
- FileListBlocks;
- IndexBlocks;
- Summary of the index.


Field Summary
protected  int blockNum
           
protected  FileListBlock fileListBlock
           
protected  boolean firstFileListBlock
           
protected  boolean firstInBlock
           
protected  boolean firstIndexBlock
           
protected  IndexBlock indexBlock
           
protected  org.jboss.virtual.VirtualFile indexFile
           
protected  java.io.RandomAccessFile indexOut
           
protected  int numFiles
           
protected  int numWords
           
protected  boolean opened
           
protected  IndexSummary summary
           
 
Constructor Summary
BlocksIndexOutput(org.jboss.virtual.VirtualFile indexFile)
           
 
Method Summary
 void addFile(IndexedFile indexedFile)
          Adds a File to the destination.
 void addWord(WordEntry entry)
          Adds a word to the destination.
 void close()
          Closes the output, releasing the resources it was using.
 void flush()
          Flushes the output.
protected  void flushFiles()
          Writes the current fileListBlock on the disk and initialises it (when it's full or it's the end of the index).
protected  void flushWords()
          Writes the current indexBlock on the disk and initialises it (when it's full or it's the end of the index).
 java.lang.Object getDestination()
          Returns the Object the output is writing to.
 void open()
          Opens the output, before writing any information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexOut

protected java.io.RandomAccessFile indexOut

blockNum

protected int blockNum

opened

protected boolean opened

indexFile

protected org.jboss.virtual.VirtualFile indexFile

fileListBlock

protected FileListBlock fileListBlock

indexBlock

protected IndexBlock indexBlock

numWords

protected int numWords

summary

protected IndexSummary summary

numFiles

protected int numFiles

firstInBlock

protected boolean firstInBlock

firstIndexBlock

protected boolean firstIndexBlock

firstFileListBlock

protected boolean firstFileListBlock
Constructor Detail

BlocksIndexOutput

public BlocksIndexOutput(org.jboss.virtual.VirtualFile indexFile)
Method Detail

addFile

public void addFile(IndexedFile indexedFile)
             throws java.io.IOException
Description copied from class: IndexOutput
Adds a File to the destination.

Specified by:
addFile in class IndexOutput
Throws:
java.io.IOException
See Also:
IndexOutput.addFile(org.teiid.internal.core.index.IndexedFile)

addWord

public void addWord(WordEntry entry)
             throws java.io.IOException
Description copied from class: IndexOutput
Adds a word to the destination.

Specified by:
addWord in class IndexOutput
Throws:
java.io.IOException
See Also:
IndexOutput.addWord(org.teiid.internal.core.index.WordEntry)

close

public void close()
           throws java.io.IOException
Description copied from class: IndexOutput
Closes the output, releasing the resources it was using.

Specified by:
close in class IndexOutput
Throws:
java.io.IOException
See Also:
IndexOutput.close()

flush

public void flush()
           throws java.io.IOException
Description copied from class: IndexOutput
Flushes the output.

Specified by:
flush in class IndexOutput
Throws:
java.io.IOException
See Also:
IndexOutput.flush()

flushFiles

protected void flushFiles()
                   throws java.io.IOException
Writes the current fileListBlock on the disk and initialises it (when it's full or it's the end of the index).

Throws:
java.io.IOException

flushWords

protected void flushWords()
                   throws java.io.IOException
Writes the current indexBlock on the disk and initialises it (when it's full or it's the end of the index).

Throws:
java.io.IOException

getDestination

public java.lang.Object getDestination()
Description copied from class: IndexOutput
Returns the Object the output is writing to. It can be a file, another type of index, ...

Specified by:
getDestination in class IndexOutput
See Also:
IndexOutput.getDestination()

open

public void open()
          throws java.io.IOException
Description copied from class: IndexOutput
Opens the output, before writing any information.

Specified by:
open in class IndexOutput
Throws:
java.io.IOException
See Also:
IndexOutput.open()


Copyright © 2011. All Rights Reserved.