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

The following are Jave code examples for showing how to use readByteArray() of the android.os.Parcel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: mi-firma-android   File: Initiative.java   View Source Code Vote up 6 votes
public void readFromParcel(Parcel in){

        String tit = in.readString();
        if (tit == null || tit.isEmpty()) {
            throw new IllegalArgumentException("El titulo no puede ser nulo ni vacio"); //$NON-NLS-1$
        }
        this.title = tit;

        this.promoter = in.readString();
        this.banner = new byte[in.readInt()];
        in.readByteArray(this.banner);

        this.initDate = (Date) in.readSerializable();
        this.endDate = (Date) in.readSerializable();

        this.numRequiredSignatures = in.readInt();
        this.id = in.readInt();
        try {
            this.promoterUrl = new URL(in.readString());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        this.numActualSignatures = in.readInt();
        this.howtoSolveAsHtml = in.readString();

    }
 
Example 2
Project: mesh-core-on-android   File: MeshElementInfo.java   View Source Code Vote up 6 votes
public MeshElementInfo createFromParcel(Parcel in) {
	MeshElementInfo eltInfo = new MeshElementInfo();
	int n;
	byte[] tmp;

	n = in.readInt();
	tmp = new byte[n];
	in.readByteArray(tmp);
	eltInfo.mMids = byteArrayToShortArray(tmp);

	n = in.readInt();
	eltInfo.mVmids = new int[n];
	in.readIntArray(eltInfo.mVmids);

	return eltInfo;
}
 
Example 3
Project: FuzzDroid   File: DexFileTransferTraceItem.java   View Source Code Vote up 5 votes
@Override
protected void readFromParcel(Parcel parcel) {
	super.readFromParcel(parcel);
	this.fileName = parcel.readString();
	
	int len = parcel.readInt();
	this.dexFile = new byte[len];
	parcel.readByteArray(this.dexFile);
}
 
Example 4
Project: PeSanKita-android   File: IdentityKeyParcelable.java   View Source Code Vote up 5 votes
public IdentityKeyParcelable(Parcel in) throws InvalidKeyException {
  int    serializedLength = in.readInt();
  byte[] serialized       = new byte[serializedLength];

  in.readByteArray(serialized);
  this.identityKey = new IdentityKey(serialized, 0);
}
 
Example 5
Project: PeSanKita-android   File: MasterSecret.java   View Source Code Vote up 5 votes
private MasterSecret(Parcel in) {
  byte[] encryptionKeyBytes = new byte[in.readInt()];
  in.readByteArray(encryptionKeyBytes);

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

  this.encryptionKey = new SecretKeySpec(encryptionKeyBytes, "AES");
  this.macKey        = new SecretKeySpec(macKeyBytes, "HmacSHA1");

  // SecretKeySpec does an internal copy in its constructor.
  Arrays.fill(encryptionKeyBytes, (byte) 0x00);
  Arrays.fill(macKeyBytes, (byte)0x00);
}
 
Example 6
Project: WiFiSDCryptoLocker   File: User.java   View Source Code Vote up 5 votes
private User(Parcel parcel) {
    this.id = parcel.readLong();
    this.username = parcel.readString();
    this.password = parcel.readString();
    this.salt = new byte[parcel.readInt()];
    parcel.readByteArray(this.salt);
    this.cryptoKey = new byte[parcel.readInt()];
    parcel.readByteArray(this.cryptoKey);
    this.cryptoKey_iv = new byte[parcel.readInt()];
    parcel.readByteArray(this.cryptoKey_iv);
    this.createdAt = new Date(parcel.readLong());
    this.passwordNotHashed = parcel.readString();
}
 
Example 7
Project: nifi-android-s2s   File: ByteArrayDataPacket.java   View Source Code Vote up 5 votes
@Override
public ByteArrayDataPacket createFromParcel(Parcel in) {
    Map<String, String> attributes = new HashMap<>();
    int numAttributes = in.readInt();
    for (int i = 0; i < numAttributes; i++) {
        attributes.put(in.readString(), in.readString());
    }
    byte[] data = new byte[in.readInt()];
    if (data.length > 0) {
        in.readByteArray(data);
    }
    return new ByteArrayDataPacket(attributes, data);
}
 
Example 8
Project: mesh-core-on-android   File: MeshDeviceInfo.java   View Source Code Vote up 5 votes
public MeshDeviceInfo createFromParcel(Parcel in) {
	MeshDeviceInfo devInfo = new MeshDeviceInfo();
	byte[] tmp = new byte[2];

	in.readByteArray(tmp);
	devInfo.mCid = (short)(((short)tmp[0]) | (((short)tmp[1]) << 8));
	
	in.readByteArray(tmp);
	devInfo.mVid = (short)(((short)tmp[0]) | (((short)tmp[1]) << 8));

	in.readByteArray(tmp);
	devInfo.mPid = (short)(((short)tmp[0]) | (((short)tmp[1]) << 8));

	return devInfo;
}
 
Example 9
Project: VideoRecorder-master   File: SavedFrames.java   View Source Code Vote up 5 votes
private void readFromParcel(Parcel in)
{
	timeStamp = in.readLong();
	frameSize = in.readInt();
	frameBytesData = new byte[frameSize];
	in.readByteArray(frameBytesData);
	cachePath = in.readString();
}
 
Example 10
Project: OpenYOLO-Android   File: Credential.java   View Source Code Vote up 5 votes
@Override
public Credential createFromParcel(Parcel source) {
    int encodedLength = source.readInt();
    byte[] encodedBytes = new byte[encodedLength];
    source.readByteArray(encodedBytes);

    try {
        return Credential.fromProtoBytes(encodedBytes);
    } catch (MalformedDataException ex) {
        throw new IllegalStateException("Unable to decode credential proto", ex);
    }
}
 
Example 11
Project: OpenYOLO-Android   File: Hint.java   View Source Code Vote up 5 votes
@Override
public Hint createFromParcel(Parcel source) {
    int length = source.readInt();
    byte[] hintBytes = new byte[length];
    source.readByteArray(hintBytes);
    try {
        return Hint.fromProtobufBytes(hintBytes);
    } catch (MalformedDataException ex) {
        throw new IllegalArgumentException("Unable to parse hint from parcel", ex);
    }
}
 
Example 12
Project: Near   File: Host.java   View Source Code Vote up 5 votes
private InetAddress getInetAddressFrom(Parcel in) {
    byte[] addr = new byte[in.readInt()];
    in.readByteArray(addr);
    try {
        return InetAddress.getByAddress(addr);
    } catch (UnknownHostException e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 13
Project: OpenYOLO-Android   File: PasswordSpecification.java   View Source Code Vote up 5 votes
@Override
public PasswordSpecification createFromParcel(Parcel parcel) {
    int encodedSize = parcel.readInt();
    byte[] encoded = new byte[encodedSize];
    parcel.readByteArray(encoded);

    Protobufs.PasswordSpecification proto;
    try {
        proto = Protobufs.PasswordSpecification.parseFrom(encoded);
        return PasswordSpecification.fromProtobuf(proto);
    } catch (IOException | MalformedDataException ex) {
        throw new IllegalStateException("Unable to read proto from parcel", ex);
    }

}
 
Example 14
Project: OpenYOLO-Android   File: QueryResponse.java   View Source Code Vote up 5 votes
@Override
public QueryResponse createFromParcel(Parcel source) {
    String responderPackage = source.readString();
    long responseId = source.readLong();
    byte[] responseMessage = null;
    if (source.readInt() != 0) {
        int responseMessageSize = source.readInt();
        responseMessage = new byte[responseMessageSize];
        source.readByteArray(responseMessage);
    }
    return new QueryResponse(responderPackage, responseId, responseMessage);
}
 
Example 15
Project: Cable-Android   File: IdentityKeyParcelable.java   View Source Code Vote up 5 votes
public IdentityKeyParcelable(Parcel in) throws InvalidKeyException {
  int    serializedLength = in.readInt();
  byte[] serialized       = new byte[serializedLength];

  in.readByteArray(serialized);
  this.identityKey = new IdentityKey(serialized, 0);
}
 
Example 16
Project: Cable-Android   File: MasterSecret.java   View Source Code Vote up 5 votes
private MasterSecret(Parcel in) {
  byte[] encryptionKeyBytes = new byte[in.readInt()];
  in.readByteArray(encryptionKeyBytes);

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

  this.encryptionKey = new SecretKeySpec(encryptionKeyBytes, "AES");
  this.macKey        = new SecretKeySpec(macKeyBytes, "HmacSHA1");

  // SecretKeySpec does an internal copy in its constructor.
  Arrays.fill(encryptionKeyBytes, (byte) 0x00);
  Arrays.fill(macKeyBytes, (byte)0x00);
}
 
Example 17
Project: okwallet   File: PaymentIntent.java   View Source Code Vote up 5 votes
private Output(final Parcel in) {
    amount = (Coin) in.readSerializable();

    final int programLength = in.readInt();
    final byte[] program = new byte[programLength];
    in.readByteArray(program);
    script = new Script(program);
}
 
Example 18
Project: mobile-store   File: FDroidServiceInfo.java   View Source Code Vote up 4 votes
private static byte[] readBytes(Parcel in) {
    byte[] bytes = new byte[in.readInt()];
    in.readByteArray(bytes);
    return bytes;
}
 
Example 19
Project: AndroidMuseumBleManager   File: ScanFilterCompat.java   View Source Code Vote up 4 votes
@Override
public ScanFilterCompat createFromParcel(Parcel in) {
    Builder builder = new Builder();
    if (in.readInt() == 1) {
        builder.setDeviceName(in.readString());
    }
    if (in.readInt() == 1) {
        builder.setDeviceAddress(in.readString());
    }
    if (in.readInt() == 1) {
        ParcelUuid uuid = in.readParcelable(ParcelUuid.class.getClassLoader());
        builder.setServiceUuid(uuid);
        if (in.readInt() == 1) {
            ParcelUuid uuidMask = in.readParcelable(
                    ParcelUuid.class.getClassLoader());
            builder.setServiceUuid(uuid, uuidMask);
        }
    }
    if (in.readInt() == 1) {
        ParcelUuid servcieDataUuid =
                in.readParcelable(ParcelUuid.class.getClassLoader());
        if (in.readInt() == 1) {
            int serviceDataLength = in.readInt();
            byte[] serviceData = new byte[serviceDataLength];
            in.readByteArray(serviceData);
            if (in.readInt() == 0) {
                builder.setServiceData(servcieDataUuid, serviceData);
            }
            else {
                int serviceDataMaskLength = in.readInt();
                byte[] serviceDataMask = new byte[serviceDataMaskLength];
                in.readByteArray(serviceDataMask);
                builder.setServiceData(
                        servcieDataUuid, serviceData, serviceDataMask);
            }
        }
    }

    int manufacturerId = in.readInt();
    if (in.readInt() == 1) {
        int manufacturerDataLength = in.readInt();
        byte[] manufacturerData = new byte[manufacturerDataLength];
        in.readByteArray(manufacturerData);
        if (in.readInt() == 0) {
            builder.setManufacturerData(manufacturerId, manufacturerData);
        }
        else {
            int manufacturerDataMaskLength = in.readInt();
            byte[] manufacturerDataMask = new byte[manufacturerDataMaskLength];
            in.readByteArray(manufacturerDataMask);
            builder.setManufacturerData(manufacturerId, manufacturerData,
                    manufacturerDataMask);
        }
    }

    return builder.build();
}
 
Example 20
Project: Exoplayer2Radio   File: PrivateCommand.java   View Source Code Vote up 4 votes
private PrivateCommand(Parcel in) {
  ptsAdjustment = in.readLong();
  identifier = in.readLong();
  commandBytes = new byte[in.readInt()];
  in.readByteArray(commandBytes);
}