Class FixedSizeTextFactory
- java.lang.Object
-
- 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 aText
object that has a fixed size when written usingWritable
methods.- Since:
- 3.0
- Author:
- Craig Macdonald
- See Also:
Text
,FixedSizeWriteableFactory
,Writable
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description FixedSizeTextFactory(int _termLength)
Make a factory object with the specified lengthFixedSizeTextFactory(java.lang.String _termLength)
Make a factory object with the specified length, decoded using Integer.parseInt()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 Writableorg.apache.hadoop.io.Text
newInstance()
Returns a new instance of Text with desired properties
-
-
-
Method Detail
-
getSize
public int getSize()
Returns the size of instance of this class when written using Writable- Specified by:
getSize
in interfaceFixedSizeWriteableFactory<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 interfaceWriteableFactory<org.apache.hadoop.io.Text>
-
-