org.terrier.structures.seralization
Class FixedSizeTextFactory

java.lang.Object
  extended by org.terrier.structures.seralization.FixedSizeTextFactory
All Implemented Interfaces:
FixedSizeWriteableFactory<org.apache.hadoop.io.Text>, WriteableFactory<org.apache.hadoop.io.Text>

public class FixedSizeTextFactory
extends java.lang.Object
implements FixedSizeWriteableFactory<org.apache.hadoop.io.Text>

Makes a Text object that has a fixed size when written using Writable methods.

Since:
3.0
Author:
Craig Macdonald
See Also:
Text, FixedSizeWriteableFactory, Writable

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
FixedSizeTextFactory(int _termLength)
          Make a factory object with the specified length
FixedSizeTextFactory(java.lang.String _termLength)
          Make a factory object with the specified length, decoded using Integer.parseInt()
 
Method Summary
static int getMaximumTextLength(int charCount)
          For the Hadoop Text class, given a String of charCount, how long is the maximum encoded bytes?
 int getSize()
          Returns the size of instance of this class when written using Writable
 org.apache.hadoop.io.Text newInstance()
          Returns a new instance of Text with desired properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

FixedSizeTextFactory

public FixedSizeTextFactory(java.lang.String _termLength)
Make a factory object with the specified length, decoded using Integer.parseInt()


FixedSizeTextFactory

public FixedSizeTextFactory(int _termLength)
Make a factory object with the specified length

Method Detail

getSize

public int getSize()
Returns the size of instance of this class when written using Writable

Specified by:
getSize in interface FixedSizeWriteableFactory<org.apache.hadoop.io.Text>

getMaximumTextLength

public static int getMaximumTextLength(int charCount)
For the Hadoop Text class, given a String of charCount, how long is the maximum encoded bytes?

Parameters:
charCount - maximum length of the String
Returns:
maximum number of bytes

newInstance

public org.apache.hadoop.io.Text newInstance()
Returns a new instance of Text with desired properties

Specified by:
newInstance in interface WriteableFactory<org.apache.hadoop.io.Text>


Terrier 3.5. Copyright © 2004-2011 University of Glasgow