public class ConfigurationDir extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BUFFER |
protected java.io.File |
configDirectory |
protected int |
containerIndex |
protected java.lang.String |
createdByMaltParserVersion |
protected java.io.BufferedWriter |
infoFile |
protected java.lang.String |
name |
protected java.lang.String |
type |
protected java.net.URL |
url |
protected java.io.File |
workingDirectory |
| Constructor and Description |
|---|
ConfigurationDir(java.lang.String name,
java.lang.String type,
int containerIndex)
Creates a new configuration directory or a configuration directory from a mco-file
|
ConfigurationDir(java.net.URL url)
Creates a configuration directory from a mco-file specified by an URL.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDataFormatInstance(java.lang.String key,
DataFormatInstance dataFormatInstance) |
protected void |
checkConfigDirectory() |
protected void |
checkNConvertConfigVersion() |
void |
copyConfigFile(java.io.File in,
java.io.File out,
Versioning versioning) |
java.lang.String |
copyToConfig(java.io.File source)
Copies a file into the configuration directory.
|
java.lang.String |
copyToConfig(java.lang.String fileUrl) |
java.lang.String |
copyToConfig(java.net.URL url) |
void |
createConfigDirectory()
Creates the configuration directory
|
void |
createConfigFile()
Creates the malt configuration file (.mco).
|
protected void |
createInfoFile() |
void |
deleteConfigDirectory()
Removes the configuration directory, if it exists and it contains a .info file.
|
void |
echoInfoFile()
Prints the content of the configuration information file to the system logger
|
protected void |
finalize() |
java.io.OutputStreamWriter |
getAppendOutputStreamWriter(java.lang.String fileName)
This method acts the same as getOutputStreamWriter with the difference that the writer append in the file
if it already exists instead of deleting the previous content before starting to write.
|
java.io.File |
getConfigDirectory()
Returns a file handler object for the configuration directory
|
java.util.jar.JarEntry |
getConfigFileEntry(java.lang.String fileName) |
java.net.URL |
getConfigFileEntryURL(java.lang.String fileName) |
java.util.jar.JarFile |
getConfigJarfile() |
int |
getContainerIndex()
Returns the option container index
|
java.lang.String |
getCreatedByMaltParserVersion()
Returns the version number of MaltParser which created the malt configuration file (.mco)
|
DataFormatInstance |
getDataFormatInstance(java.lang.String key) |
java.util.Set<java.lang.String> |
getDataFormatInstanceKeys() |
DataFormatManager |
getDataFormatManager() |
java.io.File |
getFile(java.lang.String fileName)
Returns a file handler object of a file within the configuration directory
|
java.io.BufferedWriter |
getInfoFileWriter()
Returns a writer to the configuration information file
|
DataFormatInstance |
getInputDataFormatInstance() |
java.net.URL |
getInputFormatURL() |
java.io.InputStream |
getInputStreamFromConfigFileEntry(java.lang.String fileName) |
java.io.InputStreamReader |
getInputStreamReader(java.lang.String fileName)
Creates an input stream reader for reading a file within the configuration directory.
|
java.io.InputStreamReader |
getInputStreamReader(java.lang.String fileName,
java.lang.String charSet)
Creates an input stream reader for reading a file within the configuration directory
|
java.io.InputStreamReader |
getInputStreamReaderFromConfigFile(java.lang.String fileName) |
java.io.InputStreamReader |
getInputStreamReaderFromConfigFileEntry(java.lang.String fileName,
java.lang.String charSet) |
java.lang.String |
getName()
Returns the name of the configuration directory
|
java.net.URL |
getOutputFormatURL() |
java.io.OutputStreamWriter |
getOutputStreamWriter(java.lang.String fileName)
Creates an output stream writer, where the corresponding file will be included in the
configuration directory.
|
java.io.OutputStreamWriter |
getOutputStreamWriter(java.lang.String fileName,
java.lang.String charSet)
Creates an output stream writer, where the corresponding file will be included in the configuration directory
|
SymbolTableHandler |
getSymbolTables() |
java.lang.String |
getType()
Returns the type of the configuration directory
|
java.net.URL |
getUrl()
Returns the URL to the malt configuration file (.mco)
|
java.io.File |
getWorkingDirectory()
Returns a file handler object for the working directory
|
void |
initCreatedByMaltParserVersionFromInfoFile() |
void |
initDataFormat() |
protected void |
initNameNTypeFromInfoFile(java.net.URL url) |
void |
initWorkingDirectory()
Initialize the working directory
|
void |
initWorkingDirectory(java.lang.String pathPrefixString)
Initialize the working directory according to the path.
|
protected void |
setConfigDirectory(java.io.File dir) |
void |
setContainerIndex(int containerIndex)
Sets the option container index
|
void |
setCreatedByMaltParserVersion(java.lang.String createdByMaltParserVersion)
Sets the version number of MaltParser which created the malt configuration file (.mco)
|
void |
setDataFormatManager(DataFormatManager dataFormatManager) |
protected void |
setName(java.lang.String name) |
void |
setSymbolTables(SymbolTableHandler symbolTables) |
protected void |
setType(java.lang.String type) |
protected void |
setUrl(java.net.URL url) |
int |
sizeDataFormatInstance() |
void |
terminate()
Terminates the configuration directory
|
void |
unpackConfigFile()
Unpacks the malt configuration file (.mco).
|
protected void |
unpackConfigFile(java.util.jar.JarInputStream jis) |
void |
versioning() |
protected static final int BUFFER
protected java.io.File configDirectory
protected java.lang.String name
protected java.lang.String type
protected java.io.File workingDirectory
protected java.net.URL url
protected int containerIndex
protected java.io.BufferedWriter infoFile
protected java.lang.String createdByMaltParserVersion
public ConfigurationDir(java.net.URL url) throws MaltChainedException
url - an URL to a mco-fileMaltChainedExceptionpublic ConfigurationDir(java.lang.String name, java.lang.String type, int containerIndex) throws MaltChainedException
name - the name of the configurationtype - the type of configurationcontainerIndex - the container indexMaltChainedExceptionpublic void initDataFormat() throws MaltChainedException
MaltChainedExceptionpublic java.io.OutputStreamWriter getOutputStreamWriter(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
fileName - a file namecharSet - a char setMaltChainedExceptionpublic java.io.OutputStreamWriter getOutputStreamWriter(java.lang.String fileName) throws MaltChainedException
fileName - a file nameMaltChainedExceptionpublic java.io.OutputStreamWriter getAppendOutputStreamWriter(java.lang.String fileName) throws MaltChainedException
fileName - a file nameMaltChainedExceptionpublic java.io.InputStreamReader getInputStreamReader(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
fileName - a file namecharSet - a char setMaltChainedExceptionpublic java.io.InputStreamReader getInputStreamReader(java.lang.String fileName) throws MaltChainedException
fileName - a file nameMaltChainedExceptionpublic java.util.jar.JarFile getConfigJarfile() throws MaltChainedException
MaltChainedExceptionpublic java.util.jar.JarEntry getConfigFileEntry(java.lang.String fileName) throws MaltChainedException
MaltChainedExceptionpublic java.io.InputStream getInputStreamFromConfigFileEntry(java.lang.String fileName) throws MaltChainedException
MaltChainedExceptionpublic java.io.InputStreamReader getInputStreamReaderFromConfigFileEntry(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
MaltChainedExceptionpublic java.io.InputStreamReader getInputStreamReaderFromConfigFile(java.lang.String fileName) throws MaltChainedException
MaltChainedExceptionpublic java.io.File getFile(java.lang.String fileName) throws MaltChainedException
fileName - a file nameMaltChainedExceptionpublic java.net.URL getConfigFileEntryURL(java.lang.String fileName) throws MaltChainedException
MaltChainedExceptionpublic java.lang.String copyToConfig(java.io.File source) throws MaltChainedException
source - a path to fileMaltChainedExceptionpublic java.lang.String copyToConfig(java.lang.String fileUrl) throws MaltChainedException
MaltChainedExceptionpublic java.lang.String copyToConfig(java.net.URL url) throws MaltChainedException
MaltChainedExceptionpublic void deleteConfigDirectory() throws MaltChainedException
MaltChainedExceptionpublic java.io.File getConfigDirectory()
protected void setConfigDirectory(java.io.File dir)
public void createConfigDirectory() throws MaltChainedException
MaltChainedExceptionprotected void checkConfigDirectory() throws MaltChainedException
MaltChainedExceptionprotected void createInfoFile() throws MaltChainedException
MaltChainedExceptionpublic java.io.BufferedWriter getInfoFileWriter() throws MaltChainedException
MaltChainedExceptionpublic void createConfigFile() throws MaltChainedException
MaltChainedExceptionpublic void copyConfigFile(java.io.File in, java.io.File out, Versioning versioning) throws MaltChainedException
MaltChainedExceptionprotected void initNameNTypeFromInfoFile(java.net.URL url) throws MaltChainedException
MaltChainedExceptionpublic void echoInfoFile() throws MaltChainedException
MaltChainedExceptionpublic void unpackConfigFile() throws MaltChainedException
MaltChainedExceptionprotected void unpackConfigFile(java.util.jar.JarInputStream jis) throws MaltChainedException
MaltChainedExceptionpublic java.lang.String getName()
protected void setName(java.lang.String name)
public java.lang.String getType()
protected void setType(java.lang.String type)
public java.io.File getWorkingDirectory()
public void initWorkingDirectory() throws MaltChainedException
MaltChainedExceptionpublic void initWorkingDirectory(java.lang.String pathPrefixString) throws MaltChainedException
pathPrefixString - the path to the working directoryMaltChainedExceptionpublic java.net.URL getUrl()
protected void setUrl(java.net.URL url)
public int getContainerIndex()
public void setContainerIndex(int containerIndex)
containerIndex - a option container indexpublic java.lang.String getCreatedByMaltParserVersion()
public void setCreatedByMaltParserVersion(java.lang.String createdByMaltParserVersion)
createdByMaltParserVersion - a version number of MaltParserpublic void initCreatedByMaltParserVersionFromInfoFile() throws MaltChainedException
MaltChainedExceptionpublic void versioning() throws MaltChainedException
MaltChainedExceptionprotected void checkNConvertConfigVersion() throws MaltChainedException
MaltChainedExceptionpublic void terminate() throws MaltChainedException
MaltChainedExceptionprotected void finalize() throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic SymbolTableHandler getSymbolTables()
public void setSymbolTables(SymbolTableHandler symbolTables)
public DataFormatManager getDataFormatManager()
public void setDataFormatManager(DataFormatManager dataFormatManager)
public java.util.Set<java.lang.String> getDataFormatInstanceKeys()
public boolean addDataFormatInstance(java.lang.String key, DataFormatInstance dataFormatInstance)
public DataFormatInstance getDataFormatInstance(java.lang.String key)
public int sizeDataFormatInstance()
public DataFormatInstance getInputDataFormatInstance()
public java.net.URL getInputFormatURL()
public java.net.URL getOutputFormatURL()
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.