Class PlainPasswordFile
- All Implemented Interfaces:
PasswordStore
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static org.slf4j.Loggerprivate Stringprivate Properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()getPassword(String tag) getPassword(String tag, int iteration) intgetSize()getTags()voidInitialization method to read passwords(key and element pairs) from a file.putPassword(String tag, String password)
-
Field Details
-
mPwdPath
-
mPwdStore
-
logger
private static org.slf4j.Logger logger
-
-
Constructor Details
-
PlainPasswordFile
public PlainPasswordFile()
-
-
Method Details
-
init
Initialization method to read passwords(key and element pairs) from a file.Every property occupies one line of the input stream. Each line is terminated by a line terminator (
\nor\ror\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 thekeyand the characters after the=is assigned asvalueto 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 World
assigns valueHello Worldto keyWelcome MessageIf the line doesn't have the delimiter
=, the method throws an IOException- Specified by:
initin interfacePasswordStore- Parameters:
pwdPath- the input file path.- Throws:
IOException- if an error occurred when reading from the input stream.
-
getPassword
- Specified by:
getPasswordin interfacePasswordStore
-
getPassword
- Specified by:
getPasswordin interfacePasswordStore
-
getTags
- Specified by:
getTagsin interfacePasswordStore
-
putPassword
- Specified by:
putPasswordin interfacePasswordStore
-
commit
- Specified by:
commitin interfacePasswordStore- Throws:
IOExceptionClassCastExceptionNullPointerException
-
getSize
public int getSize()
-