Java 类com.google.android.gms.wearable.DataItemAsset 实例源码

项目:WearVibrationCenter    文件:PhoneCommandListener.java   
@Nullable
private byte[] getByteArrayAsset(@Nullable DataItemAsset asset, GoogleApiClient connectedApiClient) {
    if (asset == null) {
        return null;
    }

    InputStream inputStream = Wearable.DataApi.getFdForAsset(connectedApiClient, asset).await().getInputStream();
    byte[] data = readFully(inputStream);
    if (data != null) {
        try {
            inputStream.close();
        } catch (IOException ignored) {
        }
    }

    return data;
}
项目:FMTech    文件:zzae.java   
static void zza(DataItemParcelable paramDataItemParcelable, Parcel paramParcel, int paramInt)
{
  int i = zzb.zzH(paramParcel, 20293);
  zzb.zzc(paramParcel, 1, paramDataItemParcelable.mVersionCode);
  zzb.zza$377a007(paramParcel, 2, paramDataItemParcelable.mUri, paramInt);
  Bundle localBundle = new Bundle();
  localBundle.setClassLoader(DataItemAssetParcelable.class.getClassLoader());
  Iterator localIterator = paramDataItemParcelable.zzcgg.entrySet().iterator();
  while (localIterator.hasNext())
  {
    Map.Entry localEntry = (Map.Entry)localIterator.next();
    localBundle.putParcelable((String)localEntry.getKey(), new DataItemAssetParcelable((DataItemAsset)localEntry.getValue()));
  }
  zzb.zza$f7bef55(paramParcel, 4, localBundle);
  zzb.zza$52910762(paramParcel, 5, paramDataItemParcelable.mData);
  zzb.zzI(paramParcel, i);
}
项目:locus-addon-wearables    文件:LocusWearCommService.java   
/**
 * Transforms DataItem object to custom data container which type depends on given path type
 *
 * @param p
 * @param item
 * @param <E>
 * @return
 */
public <E extends TimeStampStorable> E createStorableForPath(DataPath p, DataItem item) {
    Class<? extends TimeStampStorable> clazz = p.getContainerClass();
    if (clazz.getSimpleName().equals(EmptyCommand.class.getSimpleName())) {
        return null;
    }
    try {
        Map<String, DataItemAsset> assets = item.getAssets();
        DataItemAsset asset = assets == null ? null : assets.get(DataPath.DEFAULT_ASSET_KEY);
        if (asset == null) {
            return (E) clazz.getConstructor(byte[].class).newInstance(item.getData());
        } else {
            // blocking call - asset receive
            InputStream assetInputStream = Wearable.DataApi.getFdForAsset(
                    mGoogleApiClient, asset).await().getInputStream();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            int nRead;
            byte[] buffer = new byte[0x1000];
            while ((nRead = assetInputStream.read(buffer, 0, buffer.length)) != -1) {
                baos.write(buffer, 0, nRead);
            }
            return (E) clazz.getConstructor(byte[].class).newInstance(baos.toByteArray());
        }
    } catch (Exception e) {
        Logger.logE("DataPath", "Constructor failed for " + p.name(), e);
        return null;
    }
}
项目:FMTech    文件:zzaf.java   
public final String toString()
{
  boolean bool = Log.isLoggable("DataItem", 3);
  byte[] arrayOfByte = getByteArray("data");
  HashMap localHashMap = new HashMap(this.zzaSn);
  for (int i = 0; i < this.zzaSn; i++)
  {
    zzac localzzac = new zzac(this.zzapd, i + this.zzars);
    if (localzzac.getString("asset_key") != null) {
      localHashMap.put(localzzac.getString("asset_key"), localzzac);
    }
  }
  StringBuilder localStringBuilder1 = new StringBuilder("DataItemInternal{ ");
  localStringBuilder1.append("uri=" + getUri());
  StringBuilder localStringBuilder2 = new StringBuilder(", dataSz=");
  if (arrayOfByte == null) {}
  for (Object localObject = "null";; localObject = Integer.valueOf(arrayOfByte.length))
  {
    localStringBuilder1.append(localObject);
    localStringBuilder1.append(", numAssets=" + localHashMap.size());
    if ((!bool) || (localHashMap.isEmpty())) {
      break label330;
    }
    localStringBuilder1.append(", assets=[");
    Iterator localIterator = localHashMap.entrySet().iterator();
    for (String str = ""; localIterator.hasNext(); str = ", ")
    {
      Map.Entry localEntry = (Map.Entry)localIterator.next();
      localStringBuilder1.append(str + (String)localEntry.getKey() + ": " + ((DataItemAsset)localEntry.getValue()).getId());
    }
  }
  localStringBuilder1.append("]");
  label330:
  localStringBuilder1.append(" }");
  return localStringBuilder1.toString();
}
项目:android_external_GmsApi    文件:DataItemParcelable.java   
public Map<String, DataItemAsset> getAssets() {
    Map<String, DataItemAsset> assets = new HashMap<String, DataItemAsset>();
    this.assets.setClassLoader(DataItemAssetParcelable.class.getClassLoader());
    for (String key : this.assets.keySet()) {
        assets.put(key, (DataItemAssetParcelable) this.assets.getParcelable(key));
    }
    return assets;
}
项目:PainlessMusicPlayer    文件:WearableListenerServiceImpl.java   
private void readAlbumArt(@NonNull final DataItem mediaItem) {
    final Map<String, DataItemAsset> assets = mediaItem.getAssets();
    if (assets != null) {
        readAlbumArt(assets.get(DataPaths.Assets.ALBUM_ART));
    }
}
项目:FMTech    文件:DataItemAssetParcelable.java   
public DataItemAssetParcelable(DataItemAsset paramDataItemAsset)
{
  this.mVersionCode = 1;
  this.zzyx = ((String)zzx.zzC(paramDataItemAsset.getId()));
  this.zzvB = ((String)zzx.zzC(paramDataItemAsset.getDataItemKey()));
}
项目:android_external_GmsApi    文件:DataItemAssetParcelable.java   
@Override
public DataItemAsset freeze() {
    return this;
}
项目:android_external_GmsLib    文件:DataApiImpl.java   
@Override
public PendingResult<GetFdForAssetResult> getFdForAsset(GoogleApiClient client, DataItemAsset asset) {
    throw new UnsupportedOperationException();
}