com.alarexgroup.m2mplf.file
Class TXTFile

java.lang.Object
  extended by com.alarexgroup.m2mplf.file.TXTFile
public class TXTFile
extends java.lang.Object

Class for work with text files

Example:

TXTFile txt = new TXTFile("a:/myfile.txt");
txt.writeLine("line1");
txt.writeLine("line2");
txt.close();

Constructor Summary
TXTFile(java.lang.String filename)
          Opens text file.
TXTFile(java.lang.String filename, boolean append)
          Opens text file.
 
Method Summary
 boolean close()
          Finishes work with text file.
 java.lang.String readLine()
          Reads line from file.
 boolean writeLine(java.lang.String line)
          Write line into text file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TXTFile

public TXTFile(java.lang.String filename)
Opens text file. If doesn't exist, is created.

Parameters:
filename - - file name including path, for example: a:/myfile.txt

TXTFile

public TXTFile(java.lang.String filename,
               boolean append)
Opens text file. If didn't exist, is created.

Parameters:
filename - - file name
append - true - Entered dates will be attached to the end of file.
Method Detail

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads line from file.

Returns:
loaded line
Throws:
java.io.IOException - Exception - the line isn't possible to read

writeLine

public boolean writeLine(java.lang.String line)
Write line into text file

Parameters:
line -
Returns:
true - success

close

public boolean close()
Finishes work with text file.

Returns:
true - success