当前位置: 首页>>代码示例>>Java>>正文


Java InvalidProtocolBufferNanoException类代码示例

本文整理汇总了Java中com.google.protobuf.nano.InvalidProtocolBufferNanoException的典型用法代码示例。如果您正苦于以下问题:Java InvalidProtocolBufferNanoException类的具体用法?Java InvalidProtocolBufferNanoException怎么用?Java InvalidProtocolBufferNanoException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InvalidProtocolBufferNanoException类属于com.google.protobuf.nano包,在下文中一共展示了InvalidProtocolBufferNanoException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSensorTriggerLabelValue

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Gets the SensorTriggerLabelValue for this label.
 * If changes are made, this needs to be re-set on the Label for them to be saved.
 */
public GoosciSensorTriggerLabelValue.SensorTriggerLabelValue getSensorTriggerLabelValue() {
    if (mLabel.type == GoosciLabel.Label.SENSOR_TRIGGER) {
        try {
            return GoosciSensorTriggerLabelValue.SensorTriggerLabelValue.parseFrom(
                    mLabel.protoData);
        } catch (InvalidProtocolBufferNanoException e) {
            if (Log.isLoggable(TAG, Log.ERROR)) {
                Log.e(TAG, e.getMessage());
            }
        }
    } else {
        throwLabelValueException("SensorTriggerLabelValue", mLabel.type);
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:20,代码来源:Label.java

示例2: onCreate

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSensorId = getArguments().getString(ARG_SENSOR_ID);
    mExperimentId = getArguments().getString(ARG_EXPERIMENT_ID);
    try {
        mSensorLayout = GoosciSensorLayout.SensorLayout.parseFrom(
                getArguments().getByteArray(ARG_SENSOR_LAYOUT));
    } catch (InvalidProtocolBufferNanoException e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Error parsing the SensorLayout", e);
        }
        mSensorLayout = RecordFragment.defaultLayout(0);
    }
    mSensorLayoutPosition = getArguments().getInt(ARG_LAYOUT_POSITION);
    getDataController().getExperimentById(mExperimentId,
            new LoggingConsumer<Experiment>(TAG, "get experiment") {
                @Override
                public void success(Experiment value) {
                    mExperiment = value;
                    String triggerId = getArguments().getString(ARG_TRIGGER_ID, "");
                    mTriggerToEdit = mExperiment.getSensorTrigger(triggerId);
                    populateView(getView());
                }
            });
}
 
开发者ID:google,项目名称:science-journal,代码行数:27,代码来源:EditTriggerFragment.java

示例3: onMessageReceived

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
@Override
public void onMessageReceived(final MessageEvent messageEvent) {
    super.onMessageReceived(messageEvent);
    switch (messageEvent.getPath()) {
        case DataPaths.Messages.SEARCH_RESULT:
            WearSearchData.Results searchResults = null;
            final byte[] data = messageEvent.getData();
            if (data != null && data.length != 0) {
                try {
                    searchResults = WearSearchData.Results.parseFrom(data);
                } catch (InvalidProtocolBufferNanoException e) {
                    Log.w(TAG, e);
                }
            }
            if (searchResults == null) {
                searchResults = new WearSearchData.Results();
            }
            EventBus.getDefault().post(new EventSearchResults(searchResults));
            break;
    }
}
 
开发者ID:Doctoror,项目名称:PainlessMusicPlayer,代码行数:22,代码来源:WearableListenerServiceImpl.java

示例4: configureView

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
public final void configureView(Bundle paramBundle)
{
  this.mSelections = ContentFiltersUtils.decodeSelections(paramBundle.getString("ContentFiltersDialogView.contentFilterSelections"));
  byte[] arrayOfByte = paramBundle.getByteArray("ContentFiltersDialogView.encodedFilterRange");
  try
  {
    this.mFilterRange = ContentFilters.FilterRange.parseFrom(arrayOfByte);
    this.mListView.setAdapter(new ContentFilterChoiceAdapter(getContext(), this.mSelections, this.mFilterRange));
    this.mListView.setOnItemClickListener(this);
    return;
  }
  catch (InvalidProtocolBufferNanoException localInvalidProtocolBufferNanoException)
  {
    FinskyLog.wtf(localInvalidProtocolBufferNanoException, "Cannot parse FilterRange proto from byte[] in arguments.", new Object[0]);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:ContentFiltersDialogView.java

示例5: getDocument

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
public static Document getDocument(PurchaseParams paramPurchaseParams, Cache paramCache)
{
  if (paramPurchaseParams.document != null) {
    return paramPurchaseParams.document;
  }
  Cache.Entry localEntry = paramCache.get("InstantPurchaseDocument-" + paramPurchaseParams.docidStr);
  if ((localEntry == null) || (localEntry.isExpired())) {
    return null;
  }
  try
  {
    byte[] arrayOfByte = localEntry.data;
    Document localDocument = new Document((DocV2)MessageNano.mergeFrom$1ec43da(new DocV2(), arrayOfByte, arrayOfByte.length));
    return localDocument;
  }
  catch (InvalidProtocolBufferNanoException localInvalidProtocolBufferNanoException)
  {
    throw new RuntimeException(localInvalidProtocolBufferNanoException);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:InstantPurchaseUtils.java

示例6: restoreFavorite

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Read a favorite from the stream.
 *
 * <P>Keys arrive in any order, so screens and containers may not exist yet.
 *
 * @param key identifier for the row
 * @param buffer the serialized proto from the stream, may be larger than dataSize
 * @param dataSize the size of the proto from the stream
 * @param keys keys to mark as clean in the notes for next backup
 */
private void restoreFavorite(Key key, byte[] buffer, int dataSize, ArrayList<Key> keys) {
    if (VERBOSE) Log.v(TAG, "unpacking favorite " + key.id);
    if (DEBUG) Log.d(TAG, "read (" + buffer.length + "): " +
            Base64.encodeToString(buffer, 0, dataSize, Base64.NO_WRAP));

    if (!mRestoreEnabled) {
        if (VERBOSE) Log.v(TAG, "restore not enabled: skipping database mutation");
        return;
    }

    try {
        ContentResolver cr = mContext.getContentResolver();
        ContentValues values = unpackFavorite(buffer, 0, dataSize);
        cr.insert(Favorites.CONTENT_URI, values);
    } catch (InvalidProtocolBufferNanoException e) {
        Log.e(TAG, "failed to decode favorite", e);
    }
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:29,代码来源:LauncherBackupHelper.java

示例7: restoreScreen

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Read a screen from the stream.
 *
 * <P>Keys arrive in any order, so children of this screen may already exist.
 *
 * @param key identifier for the row
 * @param buffer the serialized proto from the stream, may be larger than dataSize
 * @param dataSize the size of the proto from the stream
 * @param keys keys to mark as clean in the notes for next backup
 */
private void restoreScreen(Key key, byte[] buffer, int dataSize, ArrayList<Key> keys) {
    if (VERBOSE) Log.v(TAG, "unpacking screen " + key.id);
    if (DEBUG) Log.d(TAG, "read (" + buffer.length + "): " +
            Base64.encodeToString(buffer, 0, dataSize, Base64.NO_WRAP));

    if (!mRestoreEnabled) {
        if (VERBOSE) Log.v(TAG, "restore not enabled: skipping database mutation");
        return;
    }

    try {
        ContentResolver cr = mContext.getContentResolver();
        ContentValues values = unpackScreen(buffer, 0, dataSize);
        cr.insert(WorkspaceScreens.CONTENT_URI, values);

    } catch (InvalidProtocolBufferNanoException e) {
        Log.e(TAG, "failed to decode screen", e);
    }
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:30,代码来源:LauncherBackupHelper.java

示例8: fromBundle

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
public static SensorTrigger fromBundle(Bundle bundle) {
    try {
        return new SensorTrigger(GoosciSensorTrigger.SensorTrigger.parseFrom(
                bundle.getByteArray(KEY_TRIGGER)));
    } catch (InvalidProtocolBufferNanoException e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Error parsing SensorTrigger");
        }
        return null;
    }
}
 
开发者ID:google,项目名称:science-journal,代码行数:12,代码来源:SensorTrigger.java

示例9: Label

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
protected Label(Parcel in) {
    int serializedSize = in.readInt();
    byte[] serialized = new byte[serializedSize];
    in.readByteArray(serialized);
    try {
        mLabel = GoosciLabel.Label.parseFrom(serialized);
    } catch (InvalidProtocolBufferNanoException ex) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "Couldn't parse label storage");
        }
    }
}
 
开发者ID:google,项目名称:science-journal,代码行数:13,代码来源:Label.java

示例10: getTextLabelValue

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Gets the GoosciTextLabelValue.TextLabelValue for this label.
 * If changes are made, this needs to be re-set on the Label for them to be saved.
 */
public GoosciTextLabelValue.TextLabelValue getTextLabelValue() {
    if (mLabel.type == GoosciLabel.Label.TEXT) {
        try {
            return GoosciTextLabelValue.TextLabelValue.parseFrom(mLabel.protoData);
        } catch (InvalidProtocolBufferNanoException e) {
            if (Log.isLoggable(TAG, Log.ERROR)) {
                Log.e(TAG, e.getMessage());
            }
        }
    } else {
        throwLabelValueException("TextLabelValue", mLabel.type);
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:19,代码来源:Label.java

示例11: getPictureLabelValue

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Gets the PictureLabelValue for this label.
 * If changes are made, this needs to be re-set on the Label for them to be saved.
 */
public GoosciPictureLabelValue.PictureLabelValue getPictureLabelValue() {
    if (mLabel.type == GoosciLabel.Label.PICTURE) {
        try {
            return GoosciPictureLabelValue.PictureLabelValue.parseFrom(mLabel.protoData);
        } catch (InvalidProtocolBufferNanoException e) {
            if (Log.isLoggable(TAG, Log.ERROR)) {
                Log.e(TAG, e.getMessage());
            }
        }
    } else {
        throwLabelValueException("PictureLabelValue", mLabel.type);
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:19,代码来源:Label.java

示例12: getSnapshotLabelValue

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
/**
 * Gets the SnapshotLabelValue for this label.
 * If changes are made, this needs to be re-set on the Label for them to be saved.
 */
public GoosciSnapshotValue.SnapshotLabelValue getSnapshotLabelValue() {
    if (mLabel.type == GoosciLabel.Label.SNAPSHOT) {
        try {
            return GoosciSnapshotValue.SnapshotLabelValue.parseFrom(mLabel.protoData);
        } catch (InvalidProtocolBufferNanoException e) {
            if (Log.isLoggable(TAG, Log.ERROR)) {
                Log.e(TAG, e.getMessage());
            }
        }
    } else {
        throwLabelValueException("SnapshotLabelValue", mLabel.type);
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:19,代码来源:Label.java

示例13: parse

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
@Nullable
private InputDevice.InputDeviceConfig parse(byte[] config) {
    try {
        return InputDevice.InputDeviceConfig.parseFrom(config);
    } catch (InvalidProtocolBufferNanoException e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "error parsing config", e);
        }
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:12,代码来源:InputDeviceSpec.java

示例14: parse

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
@Nullable
private GoosciScalarInput.ScalarInputConfig parse(byte[] config) {
    try {
        return GoosciScalarInput.ScalarInputConfig.parseFrom(config);
    } catch (InvalidProtocolBufferNanoException e) {
        if (Log.isLoggable(TAG, Log.ERROR)) {
            Log.e(TAG, "error parsing config", e);
        }
    }
    return null;
}
 
开发者ID:google,项目名称:science-journal,代码行数:12,代码来源:ScalarInputSpec.java

示例15: getDatabaseExperimentSensorLayouts

import com.google.protobuf.nano.InvalidProtocolBufferNanoException; //导入依赖的package包/类
private static List<GoosciSensorLayout.SensorLayout> getDatabaseExperimentSensorLayouts(
        SQLiteDatabase db, String experimentId) {
    List<GoosciSensorLayout.SensorLayout> layouts = new ArrayList<>();
    Cursor cursor = null;
    try {
        cursor = db.query(Tables.EXPERIMENT_SENSOR_LAYOUT,
                new String[]{ExperimentSensorLayoutColumns.LAYOUT},
                ExperimentSensorLayoutColumns.EXPERIMENT_ID + "=?",
                new String[]{experimentId}, null, null,
                ExperimentSensorLayoutColumns.POSITION + " ASC");
        Set<String> sensorIdsAdded = new HashSet<>();
        while (cursor.moveToNext()) {
            try {
                GoosciSensorLayout.SensorLayout layout =
                        GoosciSensorLayout.SensorLayout.parseFrom(cursor.getBlob(0));
                if (!sensorIdsAdded.contains(layout.sensorId)) {
                    layouts.add(layout);
                }
                sensorIdsAdded.add(layout.sensorId);
            } catch (InvalidProtocolBufferNanoException e) {
                Log.e(TAG, "Couldn't parse layout", e);
            }
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }
    return layouts;
}
 
开发者ID:google,项目名称:science-journal,代码行数:31,代码来源:SimpleMetaDataManager.java


注:本文中的com.google.protobuf.nano.InvalidProtocolBufferNanoException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。