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-fileMaltChainedException
public 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 indexMaltChainedException
public void initDataFormat() throws MaltChainedException
MaltChainedException
public java.io.OutputStreamWriter getOutputStreamWriter(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
fileName
- a file namecharSet
- a char setMaltChainedException
public java.io.OutputStreamWriter getOutputStreamWriter(java.lang.String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public java.io.OutputStreamWriter getAppendOutputStreamWriter(java.lang.String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public java.io.InputStreamReader getInputStreamReader(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
fileName
- a file namecharSet
- a char setMaltChainedException
public java.io.InputStreamReader getInputStreamReader(java.lang.String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public java.util.jar.JarFile getConfigJarfile() throws MaltChainedException
MaltChainedException
public java.util.jar.JarEntry getConfigFileEntry(java.lang.String fileName) throws MaltChainedException
MaltChainedException
public java.io.InputStream getInputStreamFromConfigFileEntry(java.lang.String fileName) throws MaltChainedException
MaltChainedException
public java.io.InputStreamReader getInputStreamReaderFromConfigFileEntry(java.lang.String fileName, java.lang.String charSet) throws MaltChainedException
MaltChainedException
public java.io.InputStreamReader getInputStreamReaderFromConfigFile(java.lang.String fileName) throws MaltChainedException
MaltChainedException
public java.io.File getFile(java.lang.String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public java.net.URL getConfigFileEntryURL(java.lang.String fileName) throws MaltChainedException
MaltChainedException
public java.lang.String copyToConfig(java.io.File source) throws MaltChainedException
source
- a path to fileMaltChainedException
public java.lang.String copyToConfig(java.lang.String fileUrl) throws MaltChainedException
MaltChainedException
public java.lang.String copyToConfig(java.net.URL url) throws MaltChainedException
MaltChainedException
public void deleteConfigDirectory() throws MaltChainedException
MaltChainedException
public java.io.File getConfigDirectory()
protected void setConfigDirectory(java.io.File dir)
public void createConfigDirectory() throws MaltChainedException
MaltChainedException
protected void checkConfigDirectory() throws MaltChainedException
MaltChainedException
protected void createInfoFile() throws MaltChainedException
MaltChainedException
public java.io.BufferedWriter getInfoFileWriter() throws MaltChainedException
MaltChainedException
public void createConfigFile() throws MaltChainedException
MaltChainedException
public void copyConfigFile(java.io.File in, java.io.File out, Versioning versioning) throws MaltChainedException
MaltChainedException
protected void initNameNTypeFromInfoFile(java.net.URL url) throws MaltChainedException
MaltChainedException
public void echoInfoFile() throws MaltChainedException
MaltChainedException
public void unpackConfigFile() throws MaltChainedException
MaltChainedException
protected void unpackConfigFile(java.util.jar.JarInputStream jis) throws MaltChainedException
MaltChainedException
public 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
MaltChainedException
public void initWorkingDirectory(java.lang.String pathPrefixString) throws MaltChainedException
pathPrefixString
- the path to the working directoryMaltChainedException
public 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
MaltChainedException
public void versioning() throws MaltChainedException
MaltChainedException
protected void checkNConvertConfigVersion() throws MaltChainedException
MaltChainedException
public void terminate() throws MaltChainedException
MaltChainedException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public 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.