Package org.apache.lucene.analysis.morph

# Class BinaryDictionaryWriter<T extends BinaryDictionary<? extends MorphData>>

java.lang.Object
org.apache.lucene.analysis.morph.BinaryDictionaryWriter<T>

public abstract class BinaryDictionaryWriter<T extends BinaryDictionary<? extends MorphData>> extends Object
Abstract base dictionary writer class.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final DictionaryEntryWriter`
`entryWriter`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`BinaryDictionaryWriter(Class<T> implClazz, DictionaryEntryWriter entryWriter)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`addMapping(int sourceId, int wordId)`
`protected final String`
`getBaseFileName()`
`int`
`put(String[] entry)`
put the entry in map
`abstract void`
`write(Path baseDir)`
Write whole dictionary in a directory.
`protected void`
`write(Path baseDir, String targetMapCodecHeader, String posDictCodecHeader, String dictCodecHeader, int dictCodecVersion)`
Write dictionary in file Dictionary format is: [Size of dictionary(int)], [entry:{left id(short)}{right id(short)}{word cost(short)}{length of pos info(short)}{pos info(char)}], [entry...], [entry...].....

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### entryWriter

protected final DictionaryEntryWriter entryWriter

## Constructor Details

### BinaryDictionaryWriter

protected BinaryDictionaryWriter(Class<T> implClazz, DictionaryEntryWriter entryWriter)

## Method Details

### put

public int put(String[] entry)
put the entry in map

Returns:
  current position of buffer, which will be wordId of next entry

### write

public abstract void write(Path baseDir) throws IOException
Write whole dictionary in a directory.

Throws:
  `IOException` - if an I/O error occurs writing the dictionary files

### addMapping

protected void addMapping(int sourceId, int wordId)

### write

protected void write(Path baseDir, String targetMapCodecHeader, String posDictCodecHeader, String dictCodecHeader, int dictCodecVersion) throws IOException
Write dictionary in file Dictionary format is: [Size of dictionary(int)], [entry:{left id(short)}{right id(short)}{word cost(short)}{length of pos info(short)}{pos info(char)}], [entry...], [entry...].....

Throws:
  `IOException` - if an I/O error occurs writing the dictionary files

### getBaseFileName

protected final String getBaseFileName()