|
||||||||
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 | |
---|---|
java.lang.String |
pw_dir
|
java.lang.String |
pw_gecos
|
int |
pw_gid
|
java.lang.String |
pw_name
|
java.lang.String |
pw_passwd
|
java.lang.String |
pw_shell
|
int |
pw_uid
|
Constructor Summary | |
---|---|
Passwd()
Access the standard passwd file. |
|
Passwd(java.lang.String path)
Access an arbitrary passwd format file. |
Method Summary | |
---|---|
void |
endpwent()
Close the passwd file. |
java.lang.String |
getPath()
|
boolean |
getpwent()
Read the next record in the passwd file. |
boolean |
getpwnam(java.lang.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 java.lang.String pw_name
public java.lang.String pw_passwd
public int pw_uid
public int pw_gid
public java.lang.String pw_gecos
public java.lang.String pw_dir
public java.lang.String pw_shell
Constructor Detail |
---|
public Passwd(java.lang.String path)
public Passwd()
/etc/passwd
.
Method Detail |
---|
public boolean getpwent() throws java.io.IOException
java.io.IOException
public java.lang.String getPath()
public void setpwent() throws java.io.IOException
java.io.IOException
public boolean getpwuid(int uid) throws java.io.IOException
uid
- The user id
java.io.IOException
public boolean getpwnam(java.lang.String nam) throws java.io.IOException
nam
- The user name
java.io.IOException
public boolean putpwent() throws java.io.IOException
java.io.IOException
public void endpwent()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |