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

The following are Jave code examples for showing how to use createByteArray() 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: q-mail   File: SMimeDecryptionResult.java   View Source Code Vote up 6 votes
public SMimeDecryptionResult createFromParcel(final Parcel source) {
    int version = source.readInt(); // parcelableVersion
    int parcelableSize = source.readInt();
    int startPosition = source.dataPosition();

    int result = source.readInt();
    byte[] sessionKey = version > 1 ? source.createByteArray() : null;
    byte[] decryptedSessionKey = version > 1 ? source.createByteArray() : null;

    SMimeDecryptionResult vr = new SMimeDecryptionResult(result, sessionKey, decryptedSessionKey);

    // skip over all fields added in future versions of this parcel
    source.setDataPosition(startPosition + parcelableSize);

    return vr;
}
 
Example 2
Project: q-mail   File: OpenPgpDecryptionResult.java   View Source Code Vote up 6 votes
public OpenPgpDecryptionResult createFromParcel(final Parcel source) {
    int version = source.readInt(); // parcelableVersion
    int parcelableSize = source.readInt();
    int startPosition = source.dataPosition();

    int result = source.readInt();
    byte[] sessionKey = version > 1 ? source.createByteArray() : null;
    byte[] decryptedSessionKey = version > 1 ? source.createByteArray() : null;

    OpenPgpDecryptionResult vr = new OpenPgpDecryptionResult(result, sessionKey, decryptedSessionKey);

    // skip over all fields added in future versions of this parcel
    source.setDataPosition(startPosition + parcelableSize);

    return vr;
}
 
Example 3
Project: mDL-ILP   File: ConnectionDescriptor.java   View Source Code Vote up 5 votes
@Override
public ConnectionDescriptor createFromParcel(Parcel in) {
    try {
        return new ConnectionDescriptor(in.createByteArray());
      } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
Example 4
Project: Phoenix-for-VK   File: VoiceMessage.java   View Source Code Vote up 5 votes
protected VoiceMessage(Parcel in) {
    super(in);
    duration = in.readInt();
    waveform = in.createByteArray();
    linkOgg = in.readString();
    linkMp3 = in.readString();
}
 
Example 5
Project: WearVibrationCenter   File: AlarmCommand.java   View Source Code Vote up 5 votes
protected AlarmCommand(Parcel in) {
    this.text = in.readString();
    this.vibrationPattern = in.createLongArray();
    this.backgroundBitmap = in.createByteArray();
    this.icon = in.createByteArray();
    this.snoozeDuration = in.readInt();
    this.doNotVibrateInTheater = in.readByte() != 0;
    this.doNotVibrateOnCharger = in.readByte() != 0;
}
 
Example 6
Project: bridge   File: BitmapWrapper.java   View Source Code Vote up 5 votes
protected BitmapWrapper(Parcel in) {
    byte[] bytes = in.createByteArray();
    mBitmap = BitmapFactory.decodeByteArray(
            bytes,
            0,
            bytes.length);
}
 
Example 7
Project: boohee_v5.6   File: QNBleDevice.java   View Source Code Vote up 5 votes
protected QNBleDevice(Parcel in) {
    this.mac = in.readString();
    this.deviceName = in.readString();
    this.rssi = in.readInt();
    this.record = in.createByteArray();
    this.device = (BluetoothDevice) in.readParcelable(BluetoothDevice.class.getClassLoader());
    this.model = in.readString();
    this.method = in.readInt();
}
 
Example 8
Project: BluetoothKit   File: BeaconDevice.java   View Source Code Vote up 5 votes
private BeaconDevice(Parcel in) {
    this.bluetoothDevice = in.readParcelable(BluetoothDevice.class.getClassLoader());
    this.rssi = in.readInt();
    this.scanRecord = in.createByteArray();
    this.deviceName = in.readString();
    this.iBeacon = in.readParcelable(IBeacon.class.getClassLoader());
    this.lastUpdatedTimeMillis = in.readLong();
}
 
Example 9
Project: Exoplayer2Radio   File: Format.java   View Source Code Vote up 5 votes
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  containerMimeType = in.readString();
  sampleMimeType = in.readString();
  codecs = in.readString();
  bitrate = in.readInt();
  maxInputSize = in.readInt();
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = in.readInt() != 0;
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  selectionFlags = in.readInt();
  language = in.readString();
  accessibilityChannel = in.readInt();
  subsampleOffsetUs = in.readLong();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  metadata = in.readParcelable(Metadata.class.getClassLoader());
}
 
Example 10
Project: Exoplayer2Radio   File: EventMessage.java   View Source Code Vote up 5 votes
EventMessage(Parcel in) {
  schemeIdUri = in.readString();
  value = in.readString();
  durationMs = in.readLong();
  id = in.readLong();
  messageData = in.createByteArray();
}
 
Example 11
Project: Exoplayer2Radio   File: ApicFrame.java   View Source Code Vote up 5 votes
ApicFrame(Parcel in) {
  super(ID);
  mimeType = in.readString();
  description = in.readString();
  pictureType = in.readInt();
  pictureData = in.createByteArray();
}
 
Example 12
Project: Exoplayer2Radio   File: GeobFrame.java   View Source Code Vote up 5 votes
GeobFrame(Parcel in) {
  super(ID);
  mimeType = in.readString();
  filename = in.readString();
  description = in.readString();
  data = in.createByteArray();
}
 
Example 13
Project: Exoplayer2Radio   File: ColorInfo.java   View Source Code Vote up 5 votes
@SuppressWarnings("ResourceType")
/* package */ ColorInfo(Parcel in) {
  colorSpace = in.readInt();
  colorRange = in.readInt();
  colorTransfer = in.readInt();
  boolean hasHdrStaticInfo = in.readInt() != 0;
  hdrStaticInfo = hasHdrStaticInfo ? in.createByteArray() : null;
}
 
Example 14
Project: q-mail   File: AutocryptPeerUpdate.java   View Source Code Vote up 4 votes
private AutocryptPeerUpdate(Parcel source, int version) {
    this.keyData = source.createByteArray();
    this.effectiveDate = source.readInt() != 0 ? new Date(source.readLong()) : null;
    this.preferEncrypt = PreferEncrypt.values()[source.readInt()];
}
 
Example 15
Project: AIMSICDL   File: SamsungMulticlientRilExecutor.java   View Source Code Vote up 4 votes
private int processSolicited(Parcel p) {
    Integer token = null;
    byte responseData[] = null;
    String stringsResponseData[] = null;
    Exception errorEx = null;

    try {
        token = p.readInt();
        int err = p.readInt();

        if (DBG) {
            Log.i(TAG, mTAG + String.format(Locale.US, ": processSolicited() token: 0x%X err: %d", token, err));
        }

        if (err != RIL_CLIENT_ERR_SUCCESS) {
            throw new RemoteException("remote error " + err);
        }

        responseData = p.createByteArray();
        stringsResponseData = p.createStringArray();

    } catch (Exception ex) {
       Log.e(TAG, mTAG + ex.getMessage());
        errorEx = ex;
    }

    if (token == null) {
       Log.e(TAG, mTAG + "token is null", errorEx);
    } else {
        synchronized (this) {
            Message m = mMessages.remove(token);

            if (m != null) {
                switch (m.what) {
                    case ID_REQUEST_AT_COMMAND:
                    case ID_RESPONSE_AT_COMMAND:
                    case RIL_REQUEST_OEM_STRINGS:
                        m.obj = new StringsResult(stringsResponseData, errorEx);
                        m.sendToTarget();
                        break;
                    default:
                        m.obj = new RawResult(responseData, errorEx);
                        m.sendToTarget();
                }
            } else {
                Log.i(TAG, mTAG + "Message with token " + token + " not found");
            }
        }
    }
    return RIL_CLIENT_ERR_SUCCESS;
}
 
Example 16
Project: WearVibrationCenter   File: ReceivedNotification.java   View Source Code Vote up 4 votes
protected ReceivedNotification(Parcel in) {
    title = in.readString();
    description = in.readString();
    imageDataPng = in.createByteArray();
}
 
Example 17
Project: Exoplayer2Radio   File: DrmInitData.java   View Source Code Vote up 4 votes
SchemeData(Parcel in) {
  uuid = new UUID(in.readLong(), in.readLong());
  mimeType = in.readString();
  data = in.createByteArray();
  requiresSecureDecryption = in.readByte() != 0;
}
 
Example 18
Project: Exoplayer2Radio   File: BinaryFrame.java   View Source Code Vote up 4 votes
BinaryFrame(Parcel in) {
  super(in.readString());
  data = in.createByteArray();
}
 
Example 19
Project: Exoplayer2Radio   File: PrivFrame.java   View Source Code Vote up 4 votes
PrivFrame(Parcel in) {
  super(ID);
  owner = in.readString();
  privateData = in.createByteArray();
}