public class PlainPasswordFile extends java.lang.Object implements IPasswordStore
Constructor and Description |
---|
PlainPasswordFile() |
Modifier and Type | Method and Description |
---|---|
void |
commit() |
java.lang.String |
getId() |
java.lang.String |
getPassword(java.lang.String tag,
int iteration) |
int |
getSize() |
java.util.Enumeration<java.lang.String> |
getTags() |
void |
init(java.lang.String pwdPath)
Initialization method to read passwords(key and element pairs) from a file.
|
java.lang.Object |
putPassword(java.lang.String tag,
java.lang.String password) |
void |
setId(java.lang.String id) |
public void init(java.lang.String pwdPath) throws java.io.IOException
Every property occupies one line of the input stream. Each line is terminated by a line terminator (
\n
or \r
or \r\n
). Lines are processed until end of
file is reached.
A line that contains only whitespace or whose first non-whitespace character is an ASCII #
is ignored (thus, #
indicates comment line).
Every line other than a blank line or a comment line describes one property to be added to the table.
The characters before the delimiter =
forms the key
and the characters after
the =
is assigned as value
to the key.
As an example, each of the following lines specify the key "Truth"
and the associated element
value "Beauty"
:
Truth = Beauty Truth= Beauty Truth =Beauty
Note that the space appearing before/after =
is ignored. However, the space appearing in between are
stored.
Example:
Welcome Message = Hello Worldassigns value
Hello World
to key Welcome Message
If the line doesn't have the delimiter =
, the method throws an IOException
init
in interface IPasswordStore
pwdPath
- the input file path.java.io.IOException
- if an error occurred when reading from the
input stream.public java.lang.String getPassword(java.lang.String tag, int iteration)
getPassword
in interface IPasswordStore
public java.util.Enumeration<java.lang.String> getTags()
getTags
in interface IPasswordStore
public java.lang.Object putPassword(java.lang.String tag, java.lang.String password)
putPassword
in interface IPasswordStore
public void commit() throws java.io.IOException, java.lang.ClassCastException, java.lang.NullPointerException
commit
in interface IPasswordStore
java.io.IOException
java.lang.ClassCastException
java.lang.NullPointerException
public java.lang.String getId()
public void setId(java.lang.String id)
setId
in interface IPasswordStore
public int getSize()