|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Reader java.io.BufferedReader java.io.LineNumberReader com.opensymphony.xwork2.util.PropertiesReader
public class PropertiesReader
This class is used to read properties lines. These lines do not terminate with new-line chars but rather when there is no backslash sign a the end of the line. This is used to concatenate multiple lines for readability. This class was pulled out of Jakarta Commons Configuration and Jakarta Commons Lang trunk revision 476093
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
PropertiesReader(Reader reader)
Constructor. |
|
PropertiesReader(Reader reader,
char listDelimiter)
Creates a new instance of PropertiesReader and sets
the underlaying reader and the list delimiter. |
Method Summary | |
---|---|
boolean |
contains(char[] array,
char objectToFind)
Checks if the object is in the given array. |
List<String> |
getCommentLines()
Returns the comment lines that have been read for the last property. |
String |
getPropertyName()
Returns the name of the last read property. |
String |
getPropertyValue()
Returns the value of the last read property. |
boolean |
nextProperty()
Parses the next property from the input stream and stores the found name and value in internal fields. |
String |
readProperty()
Reads a property line. |
static String |
unescapeJava(String str)
Unescapes any Java literals found in the String . |
protected static String |
unescapeJava(String str,
char delimiter)
Unescapes any Java literals found in the String to a
Writer . |
static void |
unescapeJava(Writer out,
String str)
Unescapes any Java literals found in the String to a
Writer . |
Methods inherited from class java.io.LineNumberReader |
---|
getLineNumber, mark, read, read, readLine, reset, setLineNumber, skip |
Methods inherited from class java.io.BufferedReader |
---|
close, markSupported, ready |
Methods inherited from class java.io.Reader |
---|
read, read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesReader(Reader reader)
reader
- A Reader.public PropertiesReader(Reader reader, char listDelimiter)
PropertiesReader
and sets
the underlaying reader and the list delimiter.
reader
- the readerlistDelimiter
- the list delimiter characterMethod Detail |
---|
public String readProperty() throws IOException
<name>
= <value>
)
IOException
- in case of an I/O errorpublic boolean nextProperty() throws IOException
IOException
- if an error occurspublic List<String> getCommentLines()
readProperty()
public String getPropertyName()
nextProperty()
was invoked and its
return value was true.
public String getPropertyValue()
nextProperty()
was invoked and
its return value was true.
protected static String unescapeJava(String str, char delimiter)
Unescapes any Java literals found in the String
to a
Writer
.
str
- the String
to unescape, may be nulldelimiter
- the delimiter for multi-valued properties
IllegalArgumentException
- if the Writer is null
public boolean contains(char[] array, char objectToFind)
Checks if the object is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughobjectToFind
- the object to find
true
if the array contains the objectpublic static String unescapeJava(String str)
Unescapes any Java literals found in the String
.
For example, it will turn a sequence of '\'
and
'n'
into a newline character, unless the '\'
is preceded by another '\'
.
str
- the String
to unescape, may be null
String
, null
if null string inputpublic static void unescapeJava(Writer out, String str) throws IOException
Unescapes any Java literals found in the String
to a
Writer
.
For example, it will turn a sequence of '\'
and
'n'
into a newline character, unless the '\'
is preceded by another '\'
.
A null
string input has no effect.
out
- the Writer
used to output unescaped charactersstr
- the String
to unescape, may be null
IllegalArgumentException
- if the Writer is null
IOException
- if error occurs on underlying Writer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |