|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.perforce.api.P4Process
public class P4Process
Handles the execution of all perforce commands. This class can be used
directly, but the preferred use of this API is through the
SourceControlObject subclasses.
Example Usage:
String l;
Env env = new Env();
String[] cmd = { "p4", "branches" };
try {
P4Process p = new P4Process(env);
p.exec(cmd);
while(null != (l = p.readLine())) {
// Parse the output.
}
p.close();
} catch(Exception ex) {
throw new PerforceException(ex.getMessage());
}
Env,
SourceControlObject,
Thread| Constructor Summary | |
|---|---|
P4Process()
Default no-argument constructor. |
|
P4Process(Env e)
Constructor that specifies the source control environment. |
|
| Method Summary | |
|---|---|
int |
close()
Waits for the underlying process to exit and closes it down. |
int |
close(java.io.PrintStream out)
Waits for the process to exit and closes out the process. |
void |
exec(java.lang.String[] cmd)
Executes a p4 command. |
void |
flush()
Flushes the output stream to the process. |
static P4Process |
getBase()
Returns the base process for this class. |
Env |
getEnv()
Returns the environment in use by this process. |
int |
getExitCode()
Returns the exit code returned when the underlying process exits. |
boolean |
getRawMode()
Returns the status of raw mode for this process. |
long |
getServerTimeout()
Return the server timeout threshold. |
java.io.Writer |
getWriter()
|
void |
outClose()
Flushes and closes the output stream to the process. |
void |
print(java.lang.String line)
Writes line to the standard input of the process. |
void |
println(java.lang.String line)
Writes line to the standard input of the process. |
java.lang.String |
readLine()
Returns the next line from the process, or null if the command has completed its execution. |
static void |
setBase(P4Process b)
Sets the base process to be used when new processes are instantiated. |
void |
setEnv(Env e)
Sets the environment to use. |
void |
setEventLog(EventLog log)
Sets the event log. |
void |
setRawMode(boolean raw)
In raw mode, the process will return the prefix added by the "-s" command line option. |
void |
setServerTimeout(long threshold)
Set the server timeout threshold. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public P4Process()
getBase()public P4Process(Env e)
e - Source control environment to use.| Method Detail |
|---|
public void setEnv(Env e)
e - Source control environment.public Env getEnv()
public static P4Process getBase()
P4Process are instantiated to share settings, including
the source control environment.
Envpublic static void setBase(P4Process b)
getBase()public java.io.Writer getWriter()
public int getExitCode()
public void setRawMode(boolean raw)
public boolean getRawMode()
public void exec(java.lang.String[] cmd)
throws java.io.IOException
cmd - Array of command line arguments ("p4" must be first).
java.io.IOExceptionpublic void setEventLog(EventLog log)
log - Log for all events.
public void print(java.lang.String line)
throws java.io.IOException
line to the standard input of the process.
line - Line to be written.
java.io.IOException
public void println(java.lang.String line)
throws java.io.IOException
line to the standard input of the process. A
newline is appended to the output.
line - Line to be written.
java.io.IOException
public void flush()
throws java.io.IOException
java.io.IOException
public void outClose()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String readLine()
public int close(java.io.PrintStream out)
throws java.io.IOException
exec method
in order to close things down properly.
out - The stream to which any errors should be sent.
java.io.IOException
public int close()
throws java.io.IOException
exec method
in order to close things out properly. Errors are sent to System.err.
java.io.IOExceptionSystempublic void setServerTimeout(long threshold)
public long getServerTimeout()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||