LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.misc
Class LyPrintWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by leon.misc.LyPrintWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
LyXmlPrintWriter

public class LyPrintWriter
extends java.io.PrintWriter

LyPrintWriter contains utility methods to write files.


Field Summary
static java.lang.String __VERSION
           
 
Method Summary
 void addIndent()
          Adds an indentation level.
static boolean checkFile(java.lang.String filename, java.lang.String destination, java.lang.String type)
          Checks if the given filename with the given extension at the given destination exits.
static java.lang.String getFilePath(java.lang.String filename, java.lang.String destination, java.lang.String type)
          Gets the file path the given filename with the given extension at the given destination exits.
 java.lang.String getIndentString()
          Gets indent string.
 int getLinesCount()
          Gets number of lines written on this writer.
static LyPrintWriter getPrintWriter(java.lang.String filename, java.lang.String destination, java.lang.String type)
          Gets the print writer associated to the given filename with the given extension at the given destination.
 void print(java.lang.String str)
          Utility methods to print, avoid ^M at the end of lines and to indent result.
 void println()
          Prints a newline character ('\n') and sets the _indentNext parameter to true.
 void println(java.lang.String str)
          Prints the given string and the newline character ('\n').
 void printnl(java.lang.String str)
          Print the given String after calling println() and printing two tabulations.
 void removeIndent()
          Removes an indentation level.
 boolean wasChanged()
          Indicates if the tag has changed or not.
 
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, write, write, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Method Detail

getFilePath

public static java.lang.String getFilePath(java.lang.String filename,
                                           java.lang.String destination,
                                           java.lang.String type)
Gets the file path the given filename with the given extension at the given destination exits.

Parameters:
filename - the name of the file where the file will be written
destination - the path of the file
type - the file extension type
Returns:
The file path.

checkFile

public static boolean checkFile(java.lang.String filename,
                                java.lang.String destination,
                                java.lang.String type)
Checks if the given filename with the given extension at the given destination exits.

Parameters:
filename - the name of the file where the file will be written
destination - the path of the file
type - the file extension type
Returns:
True if it exists, false otherwise.

getPrintWriter

public static LyPrintWriter getPrintWriter(java.lang.String filename,
                                           java.lang.String destination,
                                           java.lang.String type)
Gets the print writer associated to the given filename with the given extension at the given destination. If the file ever exist, a backup is made into the filename + type + ".bak" file.

Parameters:
filename - the name of the file where the file will be written
destination - the path of the file
type - the file extension type
Returns:
the print writer

print

public void print(java.lang.String str)
Utility methods to print, avoid ^M at the end of lines and to indent result.
If #_closeTag is set to true then print '>' character and set the attribute to false.
If _indentNext is set to true, print the number of tabulation of the _indent parameter.
Calls the super implementation and set _changed to true.

Overrides:
print in class java.io.PrintWriter

println

public void println(java.lang.String str)
Prints the given string and the newline character ('\n'). Sets _indentNext to true.

Overrides:
println in class java.io.PrintWriter

printnl

public void printnl(java.lang.String str)
Print the given String after calling println() and printing two tabulations.

Parameters:
str - the string to print

println

public void println()
Prints a newline character ('\n') and sets the _indentNext parameter to true.

Overrides:
println in class java.io.PrintWriter

addIndent

public void addIndent()
Adds an indentation level.


removeIndent

public void removeIndent()
Removes an indentation level.


wasChanged

public boolean wasChanged()
Indicates if the tag has changed or not.

Returns:
true if ths tag has changed, false otherwise

getIndentString

public java.lang.String getIndentString()
Gets indent string.

Returns:
The string used for indentation.

getLinesCount

public int getLinesCount()
Gets number of lines written on this writer.

Returns:
Number of lines written.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com