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

The following examples show how to use android.os.Parcel#readByteArray() . 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
Source File: MasterSecret.java    From bcm-android with GNU General Public License v3.0 6 votes vote down vote up
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 File: MagicLinkParcel.java    From alpha-wallet-android with 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
Source File: DesfireFileSettings.java    From external-nfc-api with Apache License 2.0 6 votes vote down vote up
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 File: NanoApp.java    From android_9.0.0_r45 with 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
Source File: MdtaMetadataEntry.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private MdtaMetadataEntry(Parcel in) {
  key = Util.castNonNull(in.readString());
  value = new byte[in.readInt()];
  in.readByteArray(value);
  localeIndicator = in.readInt();
  typeIndicator = in.readInt();
}
 
Example 6
Source File: ObservationLocation.java    From mage-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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 7
Source File: RssiCurve.java    From android_9.0.0_r45 with 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 8
Source File: NanoAppMessage.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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 9
Source File: NanoAppBinary.java    From android_9.0.0_r45 with 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 10
Source File: ContextHubMessage.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private ContextHubMessage(Parcel in) {
    mType = in.readInt();
    mVersion = in.readInt();
    int bufferLength = in.readInt();
    mData = new byte[bufferLength];
    in.readByteArray(mData);
}
 
Example 11
Source File: SdpOppOpsRecord.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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 12
Source File: NdefRecord.java    From effective_android_sample with Apache License 2.0 5 votes vote down vote up
@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 13
Source File: Tag.java    From android_9.0.0_r45 with 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 14
Source File: ServiceResult.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
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 15
Source File: Device.java    From easyble-x with 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 16
Source File: DownloadRequest.java    From MediaSDK with 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 17
Source File: TagImpl.java    From external-nfc-api with 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 18
Source File: FDroidServiceInfo.java    From fdroidclient with GNU General Public License v3.0 4 votes vote down vote up
private static byte[] readBytes(Parcel in) {
    byte[] bytes = new byte[in.readInt()];
    in.readByteArray(bytes);
    return bytes;
}
 
Example 19
Source File: PrivateCommand.java    From Telegram-FOSS with GNU General Public License v2.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 20
Source File: PrivateCommand.java    From MediaSDK with 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);
}