|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.perforce.api.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(PrintStream out)
Waits for the process to exit and closes out the process. |
void |
exec(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. |
void |
outClose()
Flushes and closes the output stream to the process. |
void |
print(String line)
Writes line to the standard input of the process. |
void |
println(String line)
Writes line to the standard input of the process. |
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. |
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 int close() throws IOException
exec
method in order to close things out properly. Errors are sent to
System.err.System
public int close(PrintStream out) throws IOException
exec
method in order to close things down properly.out
- The stream to which any errors should be sent.public void exec(String[] cmd) throws IOException
cmd
- Array of command line arguments ("p4" must be first).public void flush() throws IOException
public static P4Process getBase()
P4Process
are instantiated to share settings, including the
source control environment
.Env
public Env getEnv()
public int getExitCode()
public boolean getRawMode()
public long getServerTimeout()
public void outClose() throws IOException
public void print(String line) throws IOException
line
to the standard input of the process.line
- Line to be written.public void println(String line) throws IOException
line
to the standard input of the process. A
newline is appended to the output.line
- Line to be written.public String readLine()
public static void setBase(P4Process b)
getBase()
public void setEnv(Env e)
e
- Source control environment.public void setEventLog(EventLog log)
log
- Log for all events.public void setRawMode(boolean raw)
public void setServerTimeout(long threshold)
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |