Package org.postgresql.util
Class PGPropertyPasswordParser
java.lang.Object
org.postgresql.util.PGPropertyPasswordParser
helps to read Password File.
https://www.postgresql.org/docs/current/libpq-pgpass.html
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PGPropertyPasswordParser
(String hostname, String port, String database, String user) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
checkForPattern
(String line, String value) private String
evaluateLine
(String fullLine, int currentLine) private String
extractPassword
(String line) private String
private String
static String
getPassword
(String hostname, String port, String database, String user) Read .pgpass resourceprivate InputStream
openInputStream
(String resourceName) private String
parseInputStream
(InputStream inputStream)
-
Field Details
-
LOGGER
-
SEPARATOR
private static final char SEPARATOR- See Also:
-
hostname
-
port
-
database
-
user
-
-
Constructor Details
-
PGPropertyPasswordParser
-
-
Method Details
-
getPassword
Read .pgpass resource- Parameters:
hostname
- hostname or *port
- port or *database
- database or *user
- username or *- Returns:
- password or null
-
findPassword
-
openInputStream
- Throws:
IOException
-
findPgPasswordResourceName
-
parseInputStream
- Throws:
IOException
-
evaluateLine
-
extractPassword
-
checkForPattern
-