Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.tradefed.util;
     17 
     18 
     19 /**
     20  * Contains the result of a command.
     21  */
     22 public class CommandResult {
     23 
     24     private CommandStatus mCmdStatus = CommandStatus.TIMED_OUT;
     25     private String mStdout = null;
     26     private String mStderr = null;
     27 
     28     /**
     29      * Create a {@link CommandResult} with the default {@link CommandStatus#TIMED_OUT} status.
     30      */
     31     public CommandResult() {
     32     }
     33 
     34     /**
     35      * Create a {@link CommandResult} with the given status.
     36      *
     37      * @param status the {@link CommandStatus}
     38      */
     39     public CommandResult(CommandStatus status) {
     40         mCmdStatus = status;
     41     }
     42 
     43     /**
     44      * Get status of command.
     45      *
     46      * @return the {@link CommandStatus}
     47      */
     48     public CommandStatus getStatus() {
     49         return mCmdStatus;
     50     }
     51 
     52     public void setStatus(CommandStatus status) {
     53         mCmdStatus = status;
     54     }
     55 
     56     /**
     57      * Get the standard output produced by command.
     58      *
     59      * @return the standard output or <code>null</code> if output could not be retrieved
     60      */
     61     public String getStdout() {
     62         return mStdout;
     63     }
     64 
     65     public void setStdout(String stdout) {
     66         mStdout = stdout;
     67     }
     68 
     69     /**
     70      * Get the standard error output produced by command.
     71      *
     72      * @return the standard error or <code>null</code> if output could not be retrieved
     73      */
     74     public String getStderr() {
     75         return mStderr;
     76     }
     77 
     78     public void setStderr(String stderr) {
     79         mStderr = stderr;
     80     }
     81 }