pds.label
Class PDSUtil

java.lang.Object
  |
  +--pds.label.PDSUtil

public class PDSUtil
extends java.lang.Object

PDSUtil is a class that contains utility methods which are useful for working with instances of PDSLabel and PDS labeled products.

Since:
1.0

Field Summary
(package private)  java.util.ArrayList mLine
          Array of lines of text
(package private)  java.lang.String mNewline
          PDS convention for a newline (carriage return followed by newline)
 
Constructor Summary
PDSUtil()
          Creates and instance of a PDSUtil
 
Method Summary
 boolean loadFile(java.lang.String pathName)
          Reads the contents of a file as a set of text strings terminated with a newline character.
 void pad(int length)
          Pad each line with spaces to the given length.
 boolean padFile(java.lang.String pathName, int length)
          Reads the contents of a file and pads each line to the have the given length.
 void trimRight()
          Trim any white space from the right side of each line.
 boolean writeFile(java.lang.String pathName)
          Writes the lines to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLine

java.util.ArrayList mLine
Array of lines of text


mNewline

java.lang.String mNewline
PDS convention for a newline (carriage return followed by newline)

Constructor Detail

PDSUtil

public PDSUtil()
Creates and instance of a PDSUtil

Method Detail

padFile

public boolean padFile(java.lang.String pathName,
                       int length)
Reads the contents of a file and pads each line to the have the given length. Once the file is read and the lines padded, the new lines are written back to the same file. The length of the new lines includes the PDS standard line terminate which is the two byte sequence of carriage return and newline.

Parameters:
pathName - the fully qualified path and name of the file to parse.
length - the number of characters each line must have.
Returns:
true if the file could be opened; false otherwise.
Since:
1.0

pad

public void pad(int length)
Pad each line with spaces to the given length.

Parameters:
length - the number of characters each line must have.
Since:
1.0

trimRight

public void trimRight()
Trim any white space from the right side of each line.

Since:
1.0

loadFile

public boolean loadFile(java.lang.String pathName)
Reads the contents of a file as a set of text strings terminated with a newline character.

Parameters:
pathName - the fully qualified path and name of the file to parse.
Returns:
true if the file could be opened; false otherwise.
Since:
1.0

writeFile

public boolean writeFile(java.lang.String pathName)
Writes the lines to a file. When written ach line is terminated with the PDS newline convention (carriage return followed by newline)

Parameters:
pathName - the fully qualified path and name of the file to parse.
Returns:
true if the file could be opened; false otherwise.
Since:
1.0