FileDocCategorySizeDatePackage
TransceiveResult.javaAPI DocAndroid 5.1 API2834Thu Mar 12 22:22:10 GMT 2015android.nfc

TransceiveResult

public final class TransceiveResult extends Object implements android.os.Parcelable
Class used to pipe transceive result from the NFC service.
hide

Fields Summary
public static final int
RESULT_SUCCESS
public static final int
RESULT_FAILURE
public static final int
RESULT_TAGLOST
public static final int
RESULT_EXCEEDED_LENGTH
final int
mResult
final byte[]
mResponseData
public static final Parcelable.Creator
CREATOR
Constructors Summary
public TransceiveResult(int result, byte[] data)


           
        mResult = result;
        mResponseData = data;
    
Methods Summary
public intdescribeContents()

        return 0;
    
public byte[]getResponseOrThrow()

        switch (mResult) {
            case RESULT_SUCCESS:
                return mResponseData;
            case RESULT_TAGLOST:
                throw new TagLostException("Tag was lost.");
            case RESULT_EXCEEDED_LENGTH:
                throw new IOException("Transceive length exceeds supported maximum");
            default:
                throw new IOException("Transceive failed");
        }
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeInt(mResult);
        if (mResult == RESULT_SUCCESS) {
            dest.writeInt(mResponseData.length);
            dest.writeByteArray(mResponseData);
        }