public class ConfigurationDir extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
BUFFER |
protected File |
configDirectory |
protected int |
containerIndex |
protected String |
createdByMaltParserVersion |
protected BufferedWriter |
infoFile |
protected String |
name |
protected String |
type |
protected URL |
url |
protected File |
workingDirectory |
Constructor and Description |
---|
ConfigurationDir(String name,
String type,
int containerIndex)
Creates a new configuration directory or a configuration directory from a mco-file
|
ConfigurationDir(URL url)
Creates a configuration directory from a mco-file specified by an URL.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDataFormatInstance(String key,
DataFormatInstance dataFormatInstance) |
protected void |
checkConfigDirectory() |
protected void |
checkNConvertConfigVersion() |
void |
copyConfigFile(File in,
File out,
Versioning versioning) |
String |
copyToConfig(File source)
Copies a file into the configuration directory.
|
String |
copyToConfig(String fileUrl) |
String |
copyToConfig(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() |
OutputStreamWriter |
getAppendOutputStreamWriter(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.
|
File |
getConfigDirectory()
Returns a file handler object for the configuration directory
|
JarEntry |
getConfigFileEntry(String fileName) |
URL |
getConfigFileEntryURL(String fileName) |
JarFile |
getConfigJarfile() |
int |
getContainerIndex()
Returns the option container index
|
String |
getCreatedByMaltParserVersion()
Returns the version number of MaltParser which created the malt configuration file (.mco)
|
DataFormatInstance |
getDataFormatInstance(String key) |
Set<String> |
getDataFormatInstanceKeys() |
DataFormatManager |
getDataFormatManager() |
File |
getFile(String fileName)
Returns a file handler object of a file within the configuration directory
|
BufferedWriter |
getInfoFileWriter()
Returns a writer to the configuration information file
|
DataFormatInstance |
getInputDataFormatInstance() |
URL |
getInputFormatURL() |
InputStream |
getInputStreamFromConfigFileEntry(String fileName) |
InputStreamReader |
getInputStreamReader(String fileName)
Creates an input stream reader for reading a file within the configuration directory.
|
InputStreamReader |
getInputStreamReader(String fileName,
String charSet)
Creates an input stream reader for reading a file within the configuration directory
|
InputStreamReader |
getInputStreamReaderFromConfigFile(String fileName) |
InputStreamReader |
getInputStreamReaderFromConfigFileEntry(String fileName,
String charSet) |
String |
getName()
Returns the name of the configuration directory
|
URL |
getOutputFormatURL() |
OutputStreamWriter |
getOutputStreamWriter(String fileName)
Creates an output stream writer, where the corresponding file will be included in the
configuration directory.
|
OutputStreamWriter |
getOutputStreamWriter(String fileName,
String charSet)
Creates an output stream writer, where the corresponding file will be included in the configuration directory
|
SymbolTableHandler |
getSymbolTables() |
String |
getType()
Returns the type of the configuration directory
|
URL |
getUrl()
Returns the URL to the malt configuration file (.mco)
|
File |
getWorkingDirectory()
Returns a file handler object for the working directory
|
void |
initCreatedByMaltParserVersionFromInfoFile() |
void |
initDataFormat() |
protected void |
initNameNTypeFromInfoFile(URL url) |
void |
initWorkingDirectory()
Initialize the working directory
|
void |
initWorkingDirectory(String pathPrefixString)
Initialize the working directory according to the path.
|
protected void |
setConfigDirectory(File dir) |
void |
setContainerIndex(int containerIndex)
Sets the option container index
|
void |
setCreatedByMaltParserVersion(String createdByMaltParserVersion)
Sets the version number of MaltParser which created the malt configuration file (.mco)
|
void |
setDataFormatManager(DataFormatManager dataFormatManager) |
protected void |
setName(String name) |
void |
setSymbolTables(SymbolTableHandler symbolTables) |
protected void |
setType(String type) |
protected void |
setUrl(URL url) |
int |
sizeDataFormatInstance() |
void |
terminate()
Terminates the configuration directory
|
void |
unpackConfigFile()
Unpacks the malt configuration file (.mco).
|
protected void |
unpackConfigFile(JarInputStream jis) |
void |
versioning() |
protected static final int BUFFER
protected File configDirectory
protected File workingDirectory
protected int containerIndex
protected BufferedWriter infoFile
protected String createdByMaltParserVersion
public ConfigurationDir(URL url) throws MaltChainedException
url
- an URL to a mco-fileMaltChainedException
public ConfigurationDir(String name, 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 OutputStreamWriter getOutputStreamWriter(String fileName, String charSet) throws MaltChainedException
fileName
- a file namecharSet
- a char setMaltChainedException
public OutputStreamWriter getOutputStreamWriter(String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public OutputStreamWriter getAppendOutputStreamWriter(String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public InputStreamReader getInputStreamReader(String fileName, String charSet) throws MaltChainedException
fileName
- a file namecharSet
- a char setMaltChainedException
public InputStreamReader getInputStreamReader(String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public JarFile getConfigJarfile() throws MaltChainedException
MaltChainedException
public JarEntry getConfigFileEntry(String fileName) throws MaltChainedException
MaltChainedException
public InputStream getInputStreamFromConfigFileEntry(String fileName) throws MaltChainedException
MaltChainedException
public InputStreamReader getInputStreamReaderFromConfigFileEntry(String fileName, String charSet) throws MaltChainedException
MaltChainedException
public InputStreamReader getInputStreamReaderFromConfigFile(String fileName) throws MaltChainedException
MaltChainedException
public File getFile(String fileName) throws MaltChainedException
fileName
- a file nameMaltChainedException
public URL getConfigFileEntryURL(String fileName) throws MaltChainedException
MaltChainedException
public String copyToConfig(File source) throws MaltChainedException
source
- a path to fileMaltChainedException
public String copyToConfig(String fileUrl) throws MaltChainedException
MaltChainedException
public String copyToConfig(URL url) throws MaltChainedException
MaltChainedException
public void deleteConfigDirectory() throws MaltChainedException
MaltChainedException
public File getConfigDirectory()
protected void setConfigDirectory(File dir)
public void createConfigDirectory() throws MaltChainedException
MaltChainedException
protected void checkConfigDirectory() throws MaltChainedException
MaltChainedException
protected void createInfoFile() throws MaltChainedException
MaltChainedException
public BufferedWriter getInfoFileWriter() throws MaltChainedException
MaltChainedException
public void createConfigFile() throws MaltChainedException
MaltChainedException
public void copyConfigFile(File in, File out, Versioning versioning) throws MaltChainedException
MaltChainedException
protected void initNameNTypeFromInfoFile(URL url) throws MaltChainedException
MaltChainedException
public void echoInfoFile() throws MaltChainedException
MaltChainedException
public void unpackConfigFile() throws MaltChainedException
MaltChainedException
protected void unpackConfigFile(JarInputStream jis) throws MaltChainedException
MaltChainedException
public String getName()
public String getType()
public File getWorkingDirectory()
public void initWorkingDirectory() throws MaltChainedException
MaltChainedException
public void initWorkingDirectory(String pathPrefixString) throws MaltChainedException
pathPrefixString
- the path to the working directoryMaltChainedException
public URL getUrl()
public int getContainerIndex()
public void setContainerIndex(int containerIndex)
containerIndex
- a option container indexpublic String getCreatedByMaltParserVersion()
public void setCreatedByMaltParserVersion(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
public SymbolTableHandler getSymbolTables()
public void setSymbolTables(SymbolTableHandler symbolTables)
public DataFormatManager getDataFormatManager()
public void setDataFormatManager(DataFormatManager dataFormatManager)
public Set<String> getDataFormatInstanceKeys()
public boolean addDataFormatInstance(String key, DataFormatInstance dataFormatInstance)
public DataFormatInstance getDataFormatInstance(String key)
public int sizeDataFormatInstance()
public DataFormatInstance getInputDataFormatInstance()
public URL getInputFormatURL()
public URL getOutputFormatURL()
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.