org.terrier.structures
Class FSOMapFileLexiconOutputStream

java.lang.Object
  extended by org.terrier.structures.LexiconOutputStream<java.lang.String>
      extended by org.terrier.structures.FSOMapFileLexiconOutputStream
All Implemented Interfaces:
java.io.Closeable

public class FSOMapFileLexiconOutputStream
extends LexiconOutputStream<java.lang.String>

A LexiconOutputStream for FSOMapFileLexicon. Writes to a FSOrderedMapFile.

Since:
3.0
Author:
craigm

Field Summary
protected  Index index
           
protected  FixedSizeWriteableFactory<org.apache.hadoop.io.Text> keyFactory
           
protected  java.lang.String leValueClassname
           
protected  FSOrderedMapFile.MapFileWriter mapFileWriter
           
protected  java.lang.String structureName
           
protected  org.apache.hadoop.io.Text tempKey
           
 
Fields inherited from class org.terrier.structures.LexiconOutputStream
lexiconStream, numPointersWritten, numTermsWritten, numTokensWritten
 
Constructor Summary
FSOMapFileLexiconOutputStream(Index _index, java.lang.String _structureName, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
          Construct an instance of the class with
FSOMapFileLexiconOutputStream(Index _index, java.lang.String _structureName, FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
          Construct an instance of the class with
FSOMapFileLexiconOutputStream(Index _index, java.lang.String _structureName, FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory, java.lang.String valueFactoryClassName)
          Construct an instance of the class with
FSOMapFileLexiconOutputStream(java.lang.String filename, FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory)
          Construct an instance of the class with
FSOMapFileLexiconOutputStream(java.lang.String path, java.lang.String prefix, java.lang.String _structureName, FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory)
          Construct an instance of the class with
 
Method Summary
static void addLexiconToIndex(Index index, java.lang.String structureName, java.lang.String leValueClassname)
          Adds Lexicon to index
 void close()
          Closes the lexicon stream.
 int writeNextEntry(java.lang.String _key, LexiconEntry _value)
          Writes a lexicon entry.
 
Methods inherited from class org.terrier.structures.LexiconOutputStream
getNumberOfPointersWritten, getNumberOfTermsWritten, getNumberOfTokensWritten, incrementCounters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyFactory

protected FixedSizeWriteableFactory<org.apache.hadoop.io.Text> keyFactory

tempKey

protected org.apache.hadoop.io.Text tempKey

mapFileWriter

protected final FSOrderedMapFile.MapFileWriter mapFileWriter

index

protected Index index

leValueClassname

protected java.lang.String leValueClassname

structureName

protected final java.lang.String structureName
Constructor Detail

FSOMapFileLexiconOutputStream

public FSOMapFileLexiconOutputStream(java.lang.String filename,
                                     FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory)
                              throws java.io.IOException
Construct an instance of the class with

Parameters:
filename -
_keyFactory -
Throws:
java.io.IOException

FSOMapFileLexiconOutputStream

public FSOMapFileLexiconOutputStream(java.lang.String path,
                                     java.lang.String prefix,
                                     java.lang.String _structureName,
                                     FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory)
                              throws java.io.IOException
Construct an instance of the class with

Parameters:
path -
prefix -
_structureName -
_keyFactory -
Throws:
java.io.IOException

FSOMapFileLexiconOutputStream

public FSOMapFileLexiconOutputStream(Index _index,
                                     java.lang.String _structureName,
                                     java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
                              throws java.io.IOException
Construct an instance of the class with

Parameters:
_index -
_structureName -
valueFactoryClass -
Throws:
java.io.IOException

FSOMapFileLexiconOutputStream

public FSOMapFileLexiconOutputStream(Index _index,
                                     java.lang.String _structureName,
                                     FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory,
                                     java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
                              throws java.io.IOException
Construct an instance of the class with

Parameters:
_index -
_structureName -
_keyFactory -
valueFactoryClass -
Throws:
java.io.IOException

FSOMapFileLexiconOutputStream

public FSOMapFileLexiconOutputStream(Index _index,
                                     java.lang.String _structureName,
                                     FixedSizeWriteableFactory<org.apache.hadoop.io.Text> _keyFactory,
                                     java.lang.String valueFactoryClassName)
                              throws java.io.IOException
Construct an instance of the class with

Parameters:
_index -
_structureName -
_keyFactory -
valueFactoryClassName -
Throws:
java.io.IOException
Method Detail

writeNextEntry

public int writeNextEntry(java.lang.String _key,
                          LexiconEntry _value)
                   throws java.io.IOException
Description copied from class: LexiconOutputStream
Writes a lexicon entry.

Specified by:
writeNextEntry in class LexiconOutputStream<java.lang.String>
Parameters:
_key - the key - usually the term
_value - the lexicon entry value
Returns:
the number of bytes written to the file.
Throws:
java.io.IOException - if an I/O error occurs

close

public void close()
Description copied from class: LexiconOutputStream
Closes the lexicon stream. IOException if an I/O error occurs while closing the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class LexiconOutputStream<java.lang.String>

addLexiconToIndex

public static void addLexiconToIndex(Index index,
                                     java.lang.String structureName,
                                     java.lang.String leValueClassname)
Adds Lexicon to index

Parameters:
index -
structureName -
leValueClassname -


Terrier 3.5. Copyright © 2004-2011 University of Glasgow