Package org.terrier.structures
Class FSOMapFileLexiconOutputStreamGeneric<T1,T2 extends org.apache.hadoop.io.WritableComparable<?>>
- java.lang.Object
-
- org.terrier.structures.LexiconOutputStream<T1>
-
- org.terrier.structures.FSOMapFileLexiconOutputStreamGeneric<T1,T2>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
FSOMapFileLexiconOutputStream
public abstract class FSOMapFileLexiconOutputStreamGeneric<T1,T2 extends org.apache.hadoop.io.WritableComparable<?>> extends LexiconOutputStream<T1>
-
-
Field Summary
Fields Modifier and Type Field Description protected IndexOnDisk
index
protected FixedSizeWriteableFactory<T2>
keyFactory
protected java.lang.String
leValueClassname
protected FSOrderedMapFile.MapFileWriter
mapFileWriter
protected java.lang.String
structureName
protected T2
tempKey
-
Fields inherited from class org.terrier.structures.LexiconOutputStream
lexiconStream, numPointersWritten, numTermsWritten, numTokensWritten
-
-
Constructor Summary
Constructors Constructor Description FSOMapFileLexiconOutputStreamGeneric(java.lang.String path, java.lang.String prefix, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory)
FSOMapFileLexiconOutputStreamGeneric(java.lang.String filename, FixedSizeWriteableFactory<T2> _keyFactory)
FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass)
FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory, java.lang.String valueFactoryClassName)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static void
addLexiconToIndex(IndexOnDisk index, java.lang.String structureName, java.lang.Class<? extends Lexicon<?>> lexClass, java.lang.Class<? extends java.util.Iterator<?>> lexInputStreamClass, java.lang.Class<? extends java.util.Iterator<LexiconEntry>> lexEntryInputStreamClass, java.lang.String leValueClassname)
Adds Lexicon to indexvoid
close()
Closes the lexicon stream.protected abstract void
setKey(T1 k)
int
writeNextEntry(T1 _key, LexiconEntry _value)
Writes a lexicon entry.-
Methods inherited from class org.terrier.structures.LexiconOutputStream
getNumberOfPointersWritten, getNumberOfTermsWritten, getNumberOfTokensWritten, incrementCounters
-
-
-
-
Field Detail
-
keyFactory
protected FixedSizeWriteableFactory<T2 extends org.apache.hadoop.io.WritableComparable<?>> keyFactory
-
tempKey
protected final T2 extends org.apache.hadoop.io.WritableComparable<?> tempKey
-
mapFileWriter
protected final FSOrderedMapFile.MapFileWriter mapFileWriter
-
index
protected IndexOnDisk index
-
leValueClassname
protected java.lang.String leValueClassname
-
structureName
protected final java.lang.String structureName
-
-
Constructor Detail
-
FSOMapFileLexiconOutputStreamGeneric
public FSOMapFileLexiconOutputStreamGeneric(java.lang.String path, java.lang.String prefix, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
FSOMapFileLexiconOutputStreamGeneric
public FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass) throws java.io.IOException
- Throws:
java.io.IOException
-
FSOMapFileLexiconOutputStreamGeneric
public FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory, java.lang.Class<? extends FixedSizeWriteableFactory<LexiconEntry>> valueFactoryClass) throws java.io.IOException
- Throws:
java.io.IOException
-
FSOMapFileLexiconOutputStreamGeneric
public FSOMapFileLexiconOutputStreamGeneric(IndexOnDisk _index, java.lang.String _structureName, FixedSizeWriteableFactory<T2> _keyFactory, java.lang.String valueFactoryClassName) throws java.io.IOException
- Throws:
java.io.IOException
-
FSOMapFileLexiconOutputStreamGeneric
public FSOMapFileLexiconOutputStreamGeneric(java.lang.String filename, FixedSizeWriteableFactory<T2> _keyFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeNextEntry
public int writeNextEntry(T1 _key, LexiconEntry _value) throws java.io.IOException
Description copied from class:LexiconOutputStream
Writes a lexicon entry.- Specified by:
writeNextEntry
in classLexiconOutputStream<T1>
- 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
-
setKey
protected abstract void setKey(T1 k)
-
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classLexiconOutputStream<T1>
-
addLexiconToIndex
public static void addLexiconToIndex(IndexOnDisk index, java.lang.String structureName, java.lang.Class<? extends Lexicon<?>> lexClass, java.lang.Class<? extends java.util.Iterator<?>> lexInputStreamClass, java.lang.Class<? extends java.util.Iterator<LexiconEntry>> lexEntryInputStreamClass, java.lang.String leValueClassname)
Adds Lexicon to index- Parameters:
index
-structureName
-leValueClassname
-
-
-