|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.uci.ics.inf111.dvdvendor.lib.Persistence
public class Persistence
The Persistence class represents the interface to physically store information in a persistent way. In this case, the persistence is done in a file in the file system.
Field Summary | |
---|---|
(package private) java.lang.String |
targetFile
Contains the path of the output file. |
Constructor Summary | |
---|---|
Persistence(java.lang.String pTargetFile)
This constructor creates a persistance whose output will be shown in a file. |
Method Summary | |
---|---|
java.util.ArrayList<java.lang.String> |
read()
Reads the targetFile line by line and keep all the lines read in an ArrayList of Strings. |
void |
write(java.util.ArrayList<java.lang.String> dataToPrint)
Writes in the targetFile the arrayList of Strings passed as parameter. |
void |
write(java.lang.String dataToPrint)
Writes in the targetFile the String passed as parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.lang.String targetFile
Constructor Detail |
---|
public Persistence(java.lang.String pTargetFile) throws PersistenceException
pTargetFile
- A String containing the path of the output file. It is recommended
to use a relative path (ie "prt/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).
PersistenceException
Method Detail |
---|
public void write(java.util.ArrayList<java.lang.String> dataToPrint) throws PersistenceException
dataToPrint
- ArrayList of Strings that contains the list of Strings that
will be stored in the targetFile
PersistenceException
public void write(java.lang.String dataToPrint) throws PersistenceException
dataToPrint
- String that contains the info to be stored in the targetFile
PersistenceException
public java.util.ArrayList<java.lang.String> read() throws PersistenceException
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |