| java.lang.Object com.sun.midp.util.Properties com.sun.midp.installer.JadProperties
All known Subclasses: com.sun.midp.jadtool.AppDescriptor, com.sun.midp.installer.ManifestProperties,
JadProperties | public class JadProperties extends Properties (Code) | | This class represents a set of properties loaded from a MIDP Java
Application Descriptor. The parsing of descriptor is more relaxed than
the MIDP 1.0 specification. First, the white space that is required
before and after the property value is optional. Second, any extra
carriage returns and end of file characters are ignored. Third, the key
of the property is only checked for whitespace. Fourth, blanklines
are allowed so the save code when parsing JAR manifests.
The set of properties, though not strictly ordered, will be stored
in the same order it was read in or created, with modifications being
appended to the end of the list by default.
If an alternate encoding type is not given, when saving properties
to a stream or loading them from a stream, the ISO 8859-1 character
encoding is used.
|
Field Summary | |
final protected static int | CR Carriage Return - Unicode character 0x0D. | final protected static int | EOF End Of File - Unicode character 0x1A. | final protected static int | HT Horizontal Tab - Unicode character 0x09. | final protected static int | LF Line Feed - Unicode character 0x0A. | final protected static int | SP SPace - Unicode character 0x20. | protected char[] | lineBuffer Buffers one line from the stream. |
Constructor Summary | |
public | JadProperties() Constructor - creates an empty property list. |
Method Summary | |
protected boolean | checkKeyChars(String key) Check to see if all the chars in the key of a property are valid. | protected boolean | checkValueChars(String value) Check to see if all the chars in the value of a property are valid. | public synchronized void | load(InputStream inStream, String enc) Reads a JAD (key and element pairs) from the input stream.
The stream uses the character encoding specified by enc
Every property occupies one line of the input stream. | public synchronized void | load(InputStream inStream) Loads properties from the input stream using the default
character encoding. | public void | partialLoad(InputStream inStream, String enc, int propertiesToLoad) Loads up a given number of properties from a JAD. | protected void | putProperty(String key, String value) Store key:value pair. | protected String | readLine(Reader in) Reads one using a given reader. |
CR | final protected static int CR(Code) | | Carriage Return - Unicode character 0x0D.
|
EOF | final protected static int EOF(Code) | | End Of File - Unicode character 0x1A.
|
HT | final protected static int HT(Code) | | Horizontal Tab - Unicode character 0x09.
|
LF | final protected static int LF(Code) | | Line Feed - Unicode character 0x0A.
|
SP | final protected static int SP(Code) | | SPace - Unicode character 0x20.
|
lineBuffer | protected char[] lineBuffer(Code) | | Buffers one line from the stream.
|
JadProperties | public JadProperties()(Code) | | Constructor - creates an empty property list.
|
checkKeyChars | protected boolean checkKeyChars(String key)(Code) | | Check to see if all the chars in the key of a property are valid.
Parameters: key - key to check false if a character is not valid for a key |
checkValueChars | protected boolean checkValueChars(String value)(Code) | | Check to see if all the chars in the value of a property are valid.
Parameters: value - value to check false if a character is not valid for a value |
load | public synchronized void load(InputStream inStream, String enc) throws IOException, InvalidJadException(Code) | | Reads a JAD (key and element pairs) from the input stream.
The stream uses the character encoding specified by enc
Every property occupies one line of the input stream. Each line
is terminated by a line terminator which can be a LF, or (CR LF).
Lines from the input stream are processed until
end of file is reached on the input stream.
Every line describes one property to be added to the table.
The key consists of all the characters from beginning of the line
up to, but not including the first ASCII : .
All remaining characters on the line become part of the associated
element. The element is also trimmed of leading and trailing
whitespace.
As an example, each of the following line specifies the key
"Truth" and the associated element value
"Beauty" :
Truth: Beauty
This method will try to continue after a format error and load as
many properties it can, but throw the last error encountered.
Parameters: inStream - the input stream. Parameters: enc - character encoding used on input stream,can be null to get the default (UTF-8) exception: IOException - if an error occurred when reading from theinput stream. exception: InvalidJadException - if the JAD is not formatted correctly. |
partialLoad | public void partialLoad(InputStream inStream, String enc, int propertiesToLoad) throws IOException, InvalidJadException(Code) | | Loads up a given number of properties from a JAD.
Used when authenticating a JAD.
Parameters: inStream - the input stream. Parameters: enc - character encoding used on input stream,null for the default encoding (UTF-8) Parameters: propertiesToLoad - maximum number of properties to load exception: IOException - if an error occurred when reading from theinput stream. exception: InvalidJadException - if the JAD is not formatted correctly. |
putProperty | protected void putProperty(String key, String value)(Code) | | Store key:value pair.
Parameters: key - the key to be placed into this property list. Parameters: value - the value corresponding to key. See Also: JadProperties.getProperty |
readLine | protected String readLine(Reader in) throws IOException(Code) | | Reads one using a given reader. LF or CR LF end a line.
The end of line and end of file characters are dropped.
Parameters: in - reader for a JAD one line of the JAD or null at the end of the JAD exception: IOException - thrown by the reader |
|
|