de.tudarmstadt.ukp.jwktl.parser.ru.wikokit.base.wikipedia.util
Class FileWriter

java.lang.Object
  extended by de.tudarmstadt.ukp.jwktl.parser.ru.wikokit.base.wikipedia.util.FileWriter

public class FileWriter
extends Object


Constructor Summary
FileWriter()
           
 
Method Summary
static void createDir(String path)
          Creates parent directory for the file with the full 'path', if the directory does not exist.
 void delete()
           
static boolean existsFile(String path)
          Checks file existance.
 void Flush()
           
 String GetDir()
           
 long GetFileLength()
           
 String GetFilename()
           
 String GetFilenameWoExt()
          Get filename without the extension
 String GetPath()
           
 void Open()
           
 void Open(boolean b_append, String encode)
          Opens file stream.
 void Print(String text)
           
 void PrintNL(String text)
           
static boolean retrieveBinaryFileFromJar(String resource_name, String target_dir, Object resource)
          Extracts file with name resource_name from the jar, copies it to the target directory target_dir.
 void SetAppend(boolean b_new_append)
           
 void SetDir(String new_dir)
           
 void SetEncode(String new_encode)
           
 void setFileInHomeDir(String sub_dir, String _filename, String enc, boolean b_append)
          Opens file stream in /user home directory/.synarcher/sub_dir/_filename in encoding enc.
 void SetFilename(String new_filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileWriter

public FileWriter()
Method Detail

SetDir

public void SetDir(String new_dir)

SetFilename

public void SetFilename(String new_filename)

GetFilename

public String GetFilename()

GetPath

public String GetPath()

GetDir

public String GetDir()

SetAppend

public void SetAppend(boolean b_new_append)

SetEncode

public void SetEncode(String new_encode)

Open

public void Open()

Open

public void Open(boolean b_append,
                 String encode)
Opens file stream.

Parameters:
b_append - if true, then bytes will be written to the end of the file rather than the beginning

delete

public void delete()

Print

public void Print(String text)

PrintNL

public void PrintNL(String text)

Flush

public void Flush()

GetFilenameWoExt

public String GetFilenameWoExt()
Get filename without the extension


GetFileLength

public long GetFileLength()

setFileInHomeDir

public void setFileInHomeDir(String sub_dir,
                             String _filename,
                             String enc,
                             boolean b_append)
Opens file stream in /user home directory/.synarcher/sub_dir/_filename in encoding enc.

Parameters:
b_append - if true, then bytes will be written to the end of the file rather than the beginning Examples dump.file_dot.setFileInHomeDir("graphviz", "bat_ruwiki.dot", "Cp866",true); dump.file_bat.setFileInHomeDir("graphviz", "bat_ruwiki.bat", "Cp866",true); dump.file_sh.setFileInHomeDir("graphviz", "bat_ruwiki.sh", "Cp1251", true);

existsFile

public static boolean existsFile(String path)
Checks file existance.


createDir

public static void createDir(String path)
Creates parent directory for the file with the full 'path', if the directory does not exist.


retrieveBinaryFileFromJar

public static boolean retrieveBinaryFileFromJar(String resource_name,
                                                String target_dir,
                                                Object resource)
                                         throws Exception
Extracts file with name resource_name from the jar, copies it to the target directory target_dir.

Parameters:
target_dir - target directory, if it is not exists, then mkdir, e.g. creates `.wiwordik` folder for the target_dir=".../.wiwordik/enwikt20101030.sqlite"
Throws:
Exception
See Also:
http://www.java2s.com/Code/Java/File-Input-Output/RetreiveTextFileFromJar.htm


Copyright © 2011-2013 Ubiquitous Knowledge Processing (UKP) Lab. All Rights Reserved.