FileDocCategorySizeDatePackage
GetPropReceiver.javaAPI DocAndroid 1.5 API2298Wed May 06 22:41:08 BST 2009com.android.ddmlib

GetPropReceiver

public final class GetPropReceiver extends MultiLineReceiver
A receiver able to parse the result of the execution of {@link #GETPROP_COMMAND} on a device.

Fields Summary
static final String
GETPROP_COMMAND
private static final Pattern
GETPROP_PATTERN
private Device
mDevice
indicates if we need to read the first
Constructors Summary
public GetPropReceiver(Device device)
Creates the receiver with the device the receiver will modify.

param
device The device to modify


                         
       
        mDevice = device;
    
Methods Summary
public voiddone()

        mDevice.update(Device.CHANGE_BUILD_INFO);
    
public booleanisCancelled()

        return false;
    
public voidprocessNewLines(java.lang.String[] lines)

        // We receive an array of lines. We're expecting
        // to have the build info in the first line, and the build
        // date in the 2nd line. There seems to be an empty line
        // after all that.

        for (String line : lines) {
            if (line.length() == 0 || line.startsWith("#")) {
                continue;
            }
            
            Matcher m = GETPROP_PATTERN.matcher(line);
            if (m.matches()) {
                String label = m.group(1);
                String value = m.group(2);
                
                if (label.length() > 0) {
                    mDevice.addProperty(label, value);
                }
            }
        }