|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectposix.Passwd
public class Passwd
POSIX style access to the unix passwd file. There is no caching. This gets you the most up to date data, but if you are looking up lots of user ids, you probably want to load them into a Hashtable.
This class is implemented in Java for the standard text passwd files used by unix systems. Some unix systems replace the text format with an indexed database of some description. This improves performance when there are thousands of users, but we won't be able to take advantage of that. Such systems should still keep a text version in the usual place.
Field Summary | |
---|---|
String |
pw_dir
|
String |
pw_gecos
|
int |
pw_gid
|
String |
pw_name
|
String |
pw_passwd
|
String |
pw_shell
|
int |
pw_uid
|
Constructor Summary | |
---|---|
Passwd()
Access the standard passwd file. |
|
Passwd(String path)
Access an arbitrary passwd format file. |
Method Summary | |
---|---|
void |
endpwent()
Close the passwd file. |
String |
getPath()
|
boolean |
getpwent()
Read the next record in the passwd file. |
boolean |
getpwnam(String nam)
Read the first passwd record that matches a user name. |
boolean |
getpwuid(int uid)
Read the passwd record that matches a user id. |
boolean |
putpwent()
Update the passwd file with the current values. |
void |
setpwent()
Open and position the passwd file just before the first record. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public String pw_name
public String pw_passwd
public int pw_uid
public int pw_gid
public String pw_gecos
public String pw_dir
public String pw_shell
Constructor Detail |
---|
public Passwd(String path)
public Passwd()
/etc/passwd
.
Method Detail |
---|
public boolean getpwent() throws IOException
IOException
public String getPath()
public void setpwent() throws IOException
IOException
public boolean getpwuid(int uid) throws IOException
uid
- The user id
IOException
public boolean getpwnam(String nam) throws IOException
nam
- The user name
IOException
public boolean putpwent() throws IOException
IOException
public void endpwent()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |