public abstract class AbstractWriter extends Object
Title: PlistReader AbstractWriter
Description: Package to read and write PLIST files on OsX
Copyright: 2007, Gie Spaepen
Company: University of Antwerp
This file writes valid plist
files based on a given
PlistProperties
object and a target File
object.
Be sure to use plist
as extention. The extention will not affect
the content of the file but will not be opened by the correct program is you
want to edit the file.
Modifier and Type | Field and Description |
---|---|
private File |
file
Holds the file to write to.
|
private PlistProperties |
props
Holds the
PlistProperties object which is written to the
file. |
Constructor and Description |
---|
AbstractWriter()
Void constructor.
|
AbstractWriter(File _file)
The properties object must be specified in order to write a file.
|
AbstractWriter(File _file,
PlistProperties _props)
Preferred constructor.
|
Modifier and Type | Method and Description |
---|---|
File |
getFile()
And get that file
|
PlistProperties |
getProperties()
Get the properties.
|
private String |
makeTag(String tagname,
String value)
Wraps a
String value in a given String tagname:
<tagname>value</tagname> . |
private void |
printValue(PrintWriter _out,
int _tabIndex,
String tab,
Object _value)
This function prints the value of a given key.
|
void |
setFile(File _file)
Set the file to write to.
|
void |
setProperties(PlistProperties _props)
Set the properties.
|
void |
write()
Write the
PLIST file. |
void |
write(File _file)
Write the
PLIST file. |
void |
write(File _file,
PlistProperties _props)
Write the
PLIST file. |
private void |
writeArray(PrintWriter _out,
Vector _vector,
int _tabIndex)
This pravate function writes away a
<array> node. |
private void |
writeDictionary(PrintWriter _out,
PlistProperties _props,
int _tabIndex)
This pravate function writes away a
<dict> node. |
private File file
setFile
function or directly in the write
function.setFile(File _file)
,
write()
private PlistProperties props
PlistProperties
object which is written to the
file. Needs to be specified in the constructor, the setProperties
function or directly in the write
function.setFile(File _file)
,
write()
public AbstractWriter()
#Abstractwriter()
,
setFile(File _file)
public AbstractWriter(File _file)
_file
- FilesetProperties(PlistProperties _props)
public AbstractWriter(File _file, PlistProperties _props)
_file
- File_props
- PlistPropertiespublic void setFile(File _file)
_file
- Filepublic File getFile()
public void setProperties(PlistProperties _props)
_props
- PlistPropertiespublic PlistProperties getProperties()
public void write() throws PlistReaderException
PLIST
file. The file and properties must already be
specified.PlistReaderException
public void write(File _file) throws PlistReaderException
PLIST
file. The properties must already be
specified._file
- FilePlistReaderException
public void write(File _file, PlistProperties _props) throws PlistReaderException
PLIST
file._file
- File_props
- PlistPropertiesPlistReaderException
private void writeDictionary(PrintWriter _out, PlistProperties _props, int _tabIndex)
<dict>
node._out
- PrintWriter_props
- PlistProperties_tabIndex
- intprivate void writeArray(PrintWriter _out, Vector _vector, int _tabIndex)
<array>
node._out
- PrintWriter_vector
- Vector_tabIndex
- intprivate void printValue(PrintWriter _out, int _tabIndex, String tab, Object _value)
writeDictionary
and writeArray
when a PlistProperties
object is encountered or a Vector
._out
- PrintWriter_tabIndex
- inttab
- String_value
- Object