FileDocCategorySizeDatePackage
CrashData.javaAPI DocAndroid 1.5 API4236Wed May 06 22:41:56 BST 2009android.server.data

CrashData

public class CrashData extends Object
Crash data transfer object. Keep in sync. with the server side version.

Fields Summary
final String
id
final String
activity
final long
time
final BuildData
buildData
final ThrowableData
throwableData
final byte[]
state
Constructors Summary
public CrashData(String id, String activity, BuildData buildData, ThrowableData throwableData)

        this.id = nonNull(id);
        this.activity = nonNull(activity);
        this.buildData = nonNull(buildData);
        this.throwableData = nonNull(throwableData);
        this.time = System.currentTimeMillis();
        this.state = null;
    
public CrashData(String id, String activity, BuildData buildData, ThrowableData throwableData, byte[] state)

        this.id = nonNull(id);
        this.activity = nonNull(activity);
        this.buildData = nonNull(buildData);
        this.throwableData = nonNull(throwableData);
        this.time = System.currentTimeMillis();
        this.state = state;
    
public CrashData(DataInput in)

        int dataVersion = in.readInt();
        if (dataVersion != 0 && dataVersion != 1) {
            throw new IOException("Expected 0 or 1. Got: " + dataVersion);
        }

        this.id = in.readUTF();
        this.activity = in.readUTF();
        this.time = in.readLong();
        this.buildData = new BuildData(in);
        this.throwableData = new ThrowableData(in);
        if (dataVersion == 1) {
            int len = in.readInt();
            if (len == 0) {
                this.state = null;
            } else {
                this.state = new byte[len];
                in.readFully(this.state, 0, len);
            }
        } else {
            this.state = null;
        }
    
public CrashData(String tag, Throwable throwable)

        id = "";
        activity = tag;
        buildData = new BuildData();
        throwableData = new ThrowableData(throwable);
        time = System.currentTimeMillis();
        state = null;
    
Methods Summary
public java.lang.StringgetActivity()

        return activity;
    
public BuildDatagetBuildData()

        return buildData;
    
public java.lang.StringgetId()

        return id;
    
public byte[]getState()

        return state;
    
public ThrowableDatagetThrowableData()

        return throwableData;
    
public longgetTime()

        return time;
    
public java.lang.StringtoString()
Return a brief description of this CrashData record. The details of the representation are subject to change.

return
Returns a String representing the contents of the object.

        return "[CrashData: id=" + id + " activity=" + activity + " time=" + time +
                " buildData=" + buildData.toString() + 
                " throwableData=" + throwableData.toString() + "]";
    
public voidwrite(java.io.DataOutput out)

        // version
        if (this.state == null) {
            out.writeInt(0);
        } else {
            out.writeInt(1);
        }

        out.writeUTF(this.id);
        out.writeUTF(this.activity);
        out.writeLong(this.time);
        buildData.write(out);
        throwableData.write(out);
        if (this.state != null) {
            out.writeInt(this.state.length);
            out.write(this.state, 0, this.state.length);
        }