Terrier IR Platform
1.1.1

uk.ac.gla.terrier.structures
Class UTFLexiconOutputStream

java.lang.Object
  extended by uk.ac.gla.terrier.structures.LexiconOutputStream
      extended by uk.ac.gla.terrier.structures.UTFLexiconOutputStream
All Implemented Interfaces:
Closeable

public class UTFLexiconOutputStream
extends LexiconOutputStream

This class implements an output stream for the lexicon structure.

Version:
$Revision: 1.8 $
Author:
Vassilis Plachouras, Craig Macdonald

Constructor Summary
UTFLexiconOutputStream()
          A default constructor.
UTFLexiconOutputStream(java.io.File file)
          A constructor given the filename.
UTFLexiconOutputStream(java.lang.String filename)
          A constructor given the filename.
UTFLexiconOutputStream(java.lang.String path, java.lang.String prefix)
           
 
Method Summary
 int writeNextEntry(byte[] _term, int _termId, int _documentFrequency, int _termFrequency, long _endOffset, byte _endBitOffset)
          Writes a lexicon entry.
 int writeNextEntry(java.lang.String _term, int _termId, int _documentFrequency, int _termFrequency, long _endOffset, byte _endBitOffset)
          Writes a lexicon entry.
 
Methods inherited from class uk.ac.gla.terrier.structures.LexiconOutputStream
close, getNumberOfPointersWritten, getNumberOfTermsWritten, getNumberOfTokensWritten, setEndBitOffset, setEndOffset, setNt, setTerm, setTermId, setTF
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UTFLexiconOutputStream

public UTFLexiconOutputStream()
A default constructor.


UTFLexiconOutputStream

public UTFLexiconOutputStream(java.lang.String filename)
A constructor given the filename.

Parameters:
filename - java.lang.String the name of the lexicon file.

UTFLexiconOutputStream

public UTFLexiconOutputStream(java.io.File file)
A constructor given the filename.

Parameters:
file - java.io.File the name of the lexicon file.

UTFLexiconOutputStream

public UTFLexiconOutputStream(java.lang.String path,
                              java.lang.String prefix)
Method Detail

writeNextEntry

public int writeNextEntry(java.lang.String _term,
                          int _termId,
                          int _documentFrequency,
                          int _termFrequency,
                          long _endOffset,
                          byte _endBitOffset)
                   throws java.io.IOException
Writes a lexicon entry.

Overrides:
writeNextEntry in class LexiconOutputStream
Parameters:
_term - the string representation of the term
_termId - the terms integer identifier
_documentFrequency - the term's document frequency in the collection
_termFrequency - the term's frequency in the collection
_endOffset - the term's ending byte offset in the inverted file
_endBitOffset - the term's ending byte bit-offset in the inverted file
Returns:
the number of bytes written to the file.
Throws:
java.io.IOException - if an I/O error occurs

writeNextEntry

public int writeNextEntry(byte[] _term,
                          int _termId,
                          int _documentFrequency,
                          int _termFrequency,
                          long _endOffset,
                          byte _endBitOffset)
                   throws java.io.IOException
Writes a lexicon entry.

Overrides:
writeNextEntry in class LexiconOutputStream
Parameters:
_term - the byte representation of the term, as written by DataInput.writeUTF(). This should be ApplicationSetup.STRING_BYTE_LENGTH +2 in length
_termId - the terms integer identifier
_documentFrequency - the term's document frequency in the collection
_termFrequency - the term's frequency in the collection
_endOffset - the term's ending byte offset in the inverted file
_endBitOffset - the term's ending byte bit-offset in the inverted file
Returns:
the number of bytes written.
Throws:
java.io.IOException - if an I/O error occurs

Terrier IR Platform
1.1.1

Terrier Information Retrieval Platform 1.1.1. Copyright 2004-2007 University of Glasgow