anar

Class TextIO

java.lang.Object
  extended by anar.TextIO

public class TextIO
extends java.lang.Object

TextIO for ASCII file handling. Read/Write/PrintBuffer


Field Summary
static boolean debug
           
 java.lang.String path
           
 java.util.ArrayList<java.lang.String> text
           
 
Constructor Summary
TextIO()
          Default Constructor (do nothing)
TextIO(java.lang.String path)
          Initialize the path of the file to be written or read.
TextIO(java.lang.String path, java.util.ArrayList<java.lang.String> text)
          Constructor used for Writing directly
 
Method Summary
 void add(java.lang.String str)
           
static void append(java.lang.String path, java.util.ArrayList<java.lang.String> textFile)
          This method won't erase the file, append to the exiting content.
static void append(java.lang.String path, java.lang.String textFile)
           
static void append(java.lang.String path, java.lang.String[] textFile)
          This method won't erase the file, append to the exiting content.
 void close()
          Close and write the buffer content to the target file.
static void copyFile(java.lang.String inPath, java.lang.String outPath)
           
static void deleteDir(java.lang.String path)
           
static void deleteFile(java.lang.String path)
           
 void erase()
          Erase the target file.
static void erase(java.lang.String path)
          Erase the target file.
static void makeDir(java.lang.String path)
           
 java.lang.String nextLine()
           
 void open()
          Create an output file and keep the file open.
 void open(java.lang.String path)
           
 void print(java.util.ArrayList<java.lang.String> str)
           
 void print(java.lang.String str)
          Output into a file.
static void print(java.lang.String path, java.util.ArrayList<java.lang.String> str)
          Output in the target file.
static void print(java.lang.String path, java.lang.String str)
          Output in the target file.
static void print(java.lang.String path, java.lang.String[] str)
          Output in the target file.
 void println()
           
 void println(java.util.ArrayList<java.lang.String> str)
           
 void println(java.lang.String str)
          Output into a file.
static void println(java.lang.String path, java.util.ArrayList<java.lang.String> str)
          Output in the target file.
static void println(java.lang.String path, java.lang.String str)
          Output in the target file.
static void println(java.lang.String path, java.lang.String[] str)
          Output in the target file.
 java.util.ArrayList<java.lang.String> read()
           
static java.util.ArrayList<java.lang.String> read(java.lang.String path)
           
 void write()
           
static void write(java.lang.String path, java.util.ArrayList<java.lang.String> textFile)
           
static void write(java.lang.String path, java.lang.String textFile)
           
static void write(java.lang.String path, java.lang.String[] textFile)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

public java.lang.String path

text

public java.util.ArrayList<java.lang.String> text

debug

public static boolean debug
Constructor Detail

TextIO

public TextIO()
Default Constructor (do nothing)


TextIO

public TextIO(java.lang.String path)
Initialize the path of the file to be written or read.

Parameters:
path -

TextIO

public TextIO(java.lang.String path,
              java.util.ArrayList<java.lang.String> text)
Constructor used for Writing directly

Parameters:
path -
text -
Method Detail

add

public void add(java.lang.String str)
Parameters:
str - Add a String in TextFile Buffer

nextLine

public java.lang.String nextLine()
Returns:
Contains the next line (with an internal counter). %

read

public java.util.ArrayList<java.lang.String> read()

read

public static java.util.ArrayList<java.lang.String> read(java.lang.String path)
Parameters:
path -
Returns:
ArrayList Input a text file and return as an ArrayList of String (for each lines).

write

public void write()

write

public static void write(java.lang.String path,
                         java.util.ArrayList<java.lang.String> textFile)
Parameters:
path -
textFile - Output an ArrayList of Strings into a file with a given path.

write

public static void write(java.lang.String path,
                         java.lang.String[] textFile)
Parameters:
path -
textFile - Output an ArrayList of Strings into a file with a given path.

write

public static void write(java.lang.String path,
                         java.lang.String textFile)

append

public static void append(java.lang.String path,
                          java.util.ArrayList<java.lang.String> textFile)
This method won't erase the file, append to the exiting content.

Parameters:
path -
textFile - Output an ArrayList of Strings into a file with a given path.

append

public static void append(java.lang.String path,
                          java.lang.String[] textFile)
This method won't erase the file, append to the exiting content.

Parameters:
path -
textFile - Output an ArrayList of Strings into a file with a given path.

append

public static void append(java.lang.String path,
                          java.lang.String textFile)

open

public void open()
Create an output file and keep the file open. This should be used with println.


open

public void open(java.lang.String path)

erase

public void erase()
Erase the target file.


erase

public static void erase(java.lang.String path)
Erase the target file.

Parameters:
path -

close

public void close()
Close and write the buffer content to the target file.


println

public void println(java.lang.String str)
Output into a file. (active output)


println

public void println(java.util.ArrayList<java.lang.String> str)

println

public void println()

print

public void print(java.lang.String str)
Output into a file. (active output)


print

public void print(java.util.ArrayList<java.lang.String> str)

println

public static void println(java.lang.String path,
                           java.lang.String str)
Output in the target file.

Parameters:
path -
str -

println

public static void println(java.lang.String path,
                           java.lang.String[] str)
Output in the target file.

Parameters:
path -
str -

println

public static void println(java.lang.String path,
                           java.util.ArrayList<java.lang.String> str)
Output in the target file.

Parameters:
path -
str -

print

public static void print(java.lang.String path,
                         java.lang.String str)
Output in the target file.

Parameters:
path -
str -

print

public static void print(java.lang.String path,
                         java.lang.String[] str)
Output in the target file.

Parameters:
path -
str -

print

public static void print(java.lang.String path,
                         java.util.ArrayList<java.lang.String> str)
Output in the target file.

Parameters:
path -
str -

copyFile

public static void copyFile(java.lang.String inPath,
                            java.lang.String outPath)

deleteFile

public static void deleteFile(java.lang.String path)

makeDir

public static void makeDir(java.lang.String path)

deleteDir

public static void deleteDir(java.lang.String path)