|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.dictccfe.and.Thr net.sf.dictccfe.and.IdxLoader
public final class IdxLoader
Creates a dictionary index database. Creates an SQLite database from an index file in format for the C# version of dictccfe. Expected format of the index file:
Nested Class Summary | |
---|---|
private static class |
IdxLoader.DictDbFnFilter
Filename filter for index database files. |
private static class |
IdxLoader.DictIdxFnFilter
Filename filter for dictionary index files. |
class |
IdxLoader.WrngIdxFileException
Exception for a wrong index file format. |
Field Summary | |
---|---|
private static java.lang.String[] |
CREATE_SQLS
SQL strings executed prior to inserting data into the table. |
private static java.lang.String |
DB_SUFF
File extension for database files. |
static java.io.File |
DICT_DIR
Directory where the files reside. |
private static IdxLoader.DictDbFnFilter |
DICTDBFNFILTER
Filename filter for index database files. |
private static IdxLoader.DictIdxFnFilter |
DICTIDXFNFILTER
Filename filter for dictionary index files. |
private static java.lang.String |
IDX_SUFF
File extension for dictionary index files. |
private static java.lang.String[] |
INSERT_SQLS
Insert statements. |
private java.io.File |
m_dbfile
The name of the database file created. |
private java.io.File |
m_idxfile
The name of the index file to import. |
private IProgress |
m_progress
For showing the progress of the import process. |
private static int |
NUMINSTRANS
Number of inserts pro transaction. |
Constructor Summary | |
---|---|
IdxLoader(java.lang.CharSequence aDictionaryName,
IProgress aProgress)
Initializes the object for a creation of an index database for the given dictionary name. |
Method Summary | |
---|---|
private static boolean |
assureDir(java.io.File aFileName)
Assures that parent directories for the given file will be created. |
static java.lang.String[] |
getAvailableDictionaries()
Returns a list of dictionary index files. |
static java.lang.String |
getCharSet(int aDictType)
Returns the character set name for the given dictionary type. |
private java.io.File |
getDbFile()
Returns the name of the resulting database file. |
private static java.io.File |
getDbFile(java.lang.CharSequence aDictName)
Returns the name of the database file for the given dictionary name. |
private static java.io.File |
getIdxFile(java.lang.CharSequence aDictName)
Returns the name of the dictionary index file for the given dictionary name. |
static java.lang.String[] |
getLoadedDictionaries()
Returns a list of dictionary index databases. |
static android.database.sqlite.SQLiteDatabase |
opendb(java.lang.CharSequence aDictionaryName)
Opens a dictionary index database for the given dictionary name. |
private static int |
readInt(java.io.InputStream aStream,
byte[] aBuf)
Reads an integer number from the given stream. |
private static short |
readShort(java.io.InputStream aStream,
byte[] aBuf)
Reads a short integer number from the gven stream. |
void |
run()
Does the whole import job. |
Methods inherited from class net.sf.dictccfe.and.Thr |
---|
getGoon, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.io.File DICT_DIR
private static final int NUMINSTRANS
private static final java.lang.String[] CREATE_SQLS
private static final java.lang.String[] INSERT_SQLS
private static final java.lang.String IDX_SUFF
private static final java.lang.String DB_SUFF
private static final IdxLoader.DictIdxFnFilter DICTIDXFNFILTER
private static final IdxLoader.DictDbFnFilter DICTDBFNFILTER
private final java.io.File m_idxfile
private final java.io.File m_dbfile
private final IProgress m_progress
Constructor Detail |
---|
public IdxLoader(java.lang.CharSequence aDictionaryName, IProgress aProgress)
aDictionaryName
- the dictionary name. The dictionary index
file is expected in the place pointed
by getIdxFile(). The database file will
be created in the file pointed by getDbFile().aProgress
- for showing the progress of the import process.Method Detail |
---|
private static java.io.File getIdxFile(java.lang.CharSequence aDictName)
aDictName
- the dictionary name.
private static java.io.File getDbFile(java.lang.CharSequence aDictName)
aDictName
- the dictionary name.
public static android.database.sqlite.SQLiteDatabase opendb(java.lang.CharSequence aDictionaryName)
aDictionaryName
- the name of the dictionary.
public static java.lang.String getCharSet(int aDictType)
aDictType
- the dictionary type, 0 for DICTCC, 1 for UDDL,
2 for thesaurus files.
private static boolean assureDir(java.io.File aFileName)
aFileName
- the name of the file.
public static java.lang.String[] getLoadedDictionaries()
public static java.lang.String[] getAvailableDictionaries()
private static short readShort(java.io.InputStream aStream, byte[] aBuf) throws java.io.IOException
aStream
- the stream to read from.aBuf
- help buffer for reading bytes, at least 2 bytes.
java.io.IOException
- exceptiona read errors.private static int readInt(java.io.InputStream aStream, byte[] aBuf) throws java.io.IOException
aStream
- the stream to read fromaBuf
- help buffer for reading bytes, at least 4 bytes.
java.io.IOException
- exceptiona read errors.private final java.io.File getDbFile()
public final void run()
run
in interface java.lang.Runnable
run
in class Thr
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |