Java Code Examples for android.os.Parcel#readByteArray()

The following examples show how to use android.os.Parcel#readByteArray() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private MasterSecret(Parcel in) {
    byte[] encryptionKeyBytes = new byte[in.readInt()];
    in.readByteArray(encryptionKeyBytes);

    byte[] macKeyBytes = new byte[in.readInt()];
    in.readByteArray(macKeyBytes);

    this.accountContext = (AccountContext) in.readSerializable();
    this.encryptionKey = new SecretKeySpec(encryptionKeyBytes, "AES");
    this.macKey = new SecretKeySpec(macKeyBytes, "HmacSHA1");
    if (null != accountContext) {
        this.tag = Integer.toString(accountContext.hashCode());
    } else {
        this.tag = "unknown";
    }

    // SecretKeySpec does an internal copy in its constructor.
    Arrays.fill(encryptionKeyBytes, (byte) 0x00);
    Arrays.fill(macKeyBytes, (byte) 0x00);
}
 
Example 2
Source Project: alpha-wallet-android   File: MagicLinkParcel.java    License: MIT License 6 votes vote down vote up
private MagicLinkParcel(Parcel in)
{
    magicLink.expiry = in.readLong();
    magicLink.price = in.readDouble();
    magicLink.ticketStart = in.readInt();
    magicLink.ticketCount = in.readInt();
    magicLink.contractAddress = in.readString();
    int ticketLength = in.readInt();
    magicLink.indices = new int[ticketLength];
    in.readIntArray(magicLink.indices);

    int sigLength = in.readInt();   // must not be higher than 65 bytes
    in.readByteArray(magicLink.signature);    // in my guess, it's always is 65 bytes so it should fit.

    int messageLength = in.readInt();
    magicLink.message = new byte[messageLength];
    in.readByteArray(magicLink.message);
    magicLink.priceWei = new BigInteger(in.readString());
}
 
Example 3
public DesfireFileSettings createFromParcel(Parcel source) {
    byte fileType       = source.readByte();
    byte commSetting    = source.readByte();
    byte[] accessRights = new byte[source.readInt()];
    source.readByteArray(accessRights);

    if (fileType == STANDARD_DATA_FILE || fileType == BACKUP_DATA_FILE) {
        int fileSize = source.readInt();
        return new StandardDesfireFileSettings(fileType, commSetting, accessRights, fileSize);
    } else if (fileType == LINEAR_RECORD_FILE || fileType == CYCLIC_RECORD_FILE) {
        int recordSize = source.readInt();
        int maxRecords = source.readInt();
        int curRecords = source.readInt();
        return new RecordDesfireFileSettings(fileType, commSetting, accessRights, recordSize, maxRecords, curRecords);
    } else {
        return new UnsupportedDesfireFileSettings(fileType);
    }
}
 
Example 4
Source Project: android_9.0.0_r45   File: NanoApp.java    License: Apache License 2.0 6 votes vote down vote up
private NanoApp(Parcel in) {
    mPublisher = in.readString();
    mName = in.readString();

    mAppId = in.readLong();
    mAppVersion = in.readInt();
    mNeededReadMemBytes = in.readInt();
    mNeededWriteMemBytes = in.readInt();
    mNeededExecMemBytes = in.readInt();

    int mNeededSensorsLength = in.readInt();
    mNeededSensors = new int[mNeededSensorsLength];
    in.readIntArray(mNeededSensors);

    int mOutputEventsLength = in.readInt();
    mOutputEvents = new int[mOutputEventsLength];
    in.readIntArray(mOutputEvents);

    int binaryLength = in.readInt();
    mAppBinary = new byte[binaryLength];
    in.readByteArray(mAppBinary);
}
 
Example 5
@Override
public NdefRecord createFromParcel(Parcel in) {
    short tnf = (short)in.readInt();
    int typeLength = in.readInt();
    byte[] type = new byte[typeLength];
    in.readByteArray(type);
    int idLength = in.readInt();
    byte[] id = new byte[idLength];
    in.readByteArray(id);
    int payloadLength = in.readInt();
    byte[] payload = new byte[payloadLength];
    in.readByteArray(payload);

    return new NdefRecord(tnf, type, id, payload);
}
 
Example 6
Source Project: external-nfc-api   File: TagImpl.java    License: Apache License 2.0 5 votes vote down vote up
static byte[] readBytesWithNull(Parcel in) {
    int len = in.readInt();
    byte[] result = null;
    if (len >= 0) {
        result = new byte[len];
        in.readByteArray(result);
    }
    return result;
}
 
Example 7
Source Project: MediaSDK   File: DownloadRequest.java    License: Apache License 2.0 5 votes vote down vote up
DownloadRequest(Parcel in) {
  id = castNonNull(in.readString());
  type = castNonNull(in.readString());
  uri = Uri.parse(castNonNull(in.readString()));
  int streamKeyCount = in.readInt();
  ArrayList<StreamKey> mutableStreamKeys = new ArrayList<>(streamKeyCount);
  for (int i = 0; i < streamKeyCount; i++) {
    mutableStreamKeys.add(in.readParcelable(StreamKey.class.getClassLoader()));
  }
  streamKeys = Collections.unmodifiableList(mutableStreamKeys);
  customCacheKey = in.readString();
  data = new byte[in.readInt()];
  in.readByteArray(data);
}
 
Example 8
Source Project: easyble-x   File: Device.java    License: Apache License 2.0 5 votes vote down vote up
public void readFromParcel(Parcel in) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        this.scanResult = in.readParcelable(ScanResult.class.getClassLoader());
    }
    int scanRecordLen = in.readInt();
    if (scanRecordLen > 0) {
        this.scanRecord = new byte[scanRecordLen];
        in.readByteArray(this.scanRecord);
    }
    String inName = in.readString();
    this.name = inName == null ? "" : inName;
    this.address = Objects.requireNonNull(in.readString());
    this.rssi = in.readInt();
    this.connectionState = ConnectionState.valueOf(in.readString());
}
 
Example 9
private byte[] readArrayFromParcel(Parcel src) {
	if (src.readByte() == (byte)1) {
		return null;
	}
	int arraySize = src.readInt();
	byte[] result = new byte[arraySize];
	src.readByteArray(result);
	return result;
}
 
Example 10
Source Project: android_9.0.0_r45   File: Tag.java    License: Apache License 2.0 5 votes vote down vote up
static byte[] readBytesWithNull(Parcel in) {
    int len = in.readInt();
    byte[] result = null;
    if (len >= 0) {
        result = new byte[len];
        in.readByteArray(result);
    }
    return result;
}
 
Example 11
private MdtaMetadataEntry(Parcel in) {
  key = Util.castNonNull(in.readString());
  value = new byte[in.readInt()];
  in.readByteArray(value);
  localeIndicator = in.readInt();
  typeIndicator = in.readInt();
}
 
Example 12
public SdpOppOpsRecord(Parcel in) {
    mRfcommChannel = in.readInt();
    mL2capPsm = in.readInt();
    mProfileVersion = in.readInt();
    mServiceName = in.readString();
    int arrayLength = in.readInt();
    if (arrayLength > 0) {
        byte[] bytes = new byte[arrayLength];
        in.readByteArray(bytes);
        mFormatsList = bytes;
    } else {
        mFormatsList = null;
    }
}
 
Example 13
private ContextHubMessage(Parcel in) {
    mType = in.readInt();
    mVersion = in.readInt();
    int bufferLength = in.readInt();
    mData = new byte[bufferLength];
    in.readByteArray(mData);
}
 
Example 14
Source Project: android_9.0.0_r45   File: NanoAppBinary.java    License: Apache License 2.0 5 votes vote down vote up
private NanoAppBinary(Parcel in) {
    int binaryLength = in.readInt();
    mNanoAppBinary = new byte[binaryLength];
    in.readByteArray(mNanoAppBinary);

    parseBinaryHeader();
}
 
Example 15
private NanoAppMessage(Parcel in) {
    mNanoAppId = in.readLong();
    mIsBroadcasted = (in.readInt() == 1);
    mMessageType = in.readInt();

    int msgSize = in.readInt();
    mMessageBody = new byte[msgSize];
    in.readByteArray(mMessageBody);
}
 
Example 16
Source Project: android_9.0.0_r45   File: RssiCurve.java    License: Apache License 2.0 5 votes vote down vote up
private RssiCurve(Parcel in) {
    start = in.readInt();
    bucketWidth = in.readInt();
    int bucketCount = in.readInt();
    rssiBuckets = new byte[bucketCount];
    in.readByteArray(rssiBuckets);
    activeNetworkRssiBoost = in.readInt();
}
 
Example 17
/**
 * Constructor for Parcelable implementation
 *
 * @param in parecel object
 */
public ObservationLocation(Parcel in) {
    byte[] geometryBytes = new byte[in.readInt()];
    in.readByteArray(geometryBytes);
    geometry = GeometryUtility.toGeometry(geometryBytes);
    accuracy = (Float) in.readValue(Float.class.getClassLoader());
    provider = in.readString();
    time = in.readLong();
    elapsedRealtimeNanos = in.readLong();
}
 
Example 18
Source Project: MediaSDK   File: PrivateCommand.java    License: Apache License 2.0 4 votes vote down vote up
private PrivateCommand(Parcel in) {
  ptsAdjustment = in.readLong();
  identifier = in.readLong();
  commandBytes = new byte[in.readInt()];
  in.readByteArray(commandBytes);
}
 
Example 19
private static byte[] readBytes(Parcel in) {
    byte[] bytes = new byte[in.readInt()];
    in.readByteArray(bytes);
    return bytes;
}
 
Example 20
private PrivateCommand(Parcel in) {
  ptsAdjustment = in.readLong();
  identifier = in.readLong();
  commandBytes = new byte[in.readInt()];
  in.readByteArray(commandBytes);
}