|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.inf111.dvdvendor.devices.Printer
public class Printer
This class represents the printer of the system. The output of this printer could be the console or a file.
Field Summary | |
---|---|
(package private) int |
lineLength
Contains the maximum length of the printer. |
private Persistence |
persistence
Persistence object that will help to persist the information in the Printer. |
(package private) java.lang.String |
targetFile
Contains the path of the output file for the printer. |
Constructor Summary | |
---|---|
Printer()
This constructor creates a printer whose output will be shown in the console screen. |
|
Printer(java.lang.String pTargetFile)
This constructor creates a printer whose output will be shown in a file. |
Method Summary | |
---|---|
private boolean |
checkLength(java.lang.String line)
Checks that the length of a String does not exceed lineLength. |
int |
getLineLength()
Return the value of lineLength |
void |
print(java.util.ArrayList<java.lang.String> dataToPrint)
Prints the arrayList of Strings passed as parameter on the screen or file, depending on the constructor used to create the printer object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Persistence persistence
int lineLength
java.lang.String targetFile
Constructor Detail |
---|
public Printer()
public Printer(java.lang.String pTargetFile) throws PrinterException, PersistenceException
pTargetFile
- A String containing the path of the output file. It is recommended
to use a relative path (ie "ptr/PrinterOutput.txt") due to the fact that this will
work with both PC and MAC. If you create it using a relative path,
the file will be stored in the location of your project (Right click on the project,
Properties, see Location).
PrinterException
PersistenceException
Method Detail |
---|
public void print(java.util.ArrayList<java.lang.String> dataToPrint) throws PrinterException, PersistenceException
dataToPrint
- ArrayList of Strings that contains the list of Strings that
will be printed
PrinterException
PersistenceException
public int getLineLength()
private boolean checkLength(java.lang.String line)
line
-
true
if the string length is greater than lineLength; false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |