本文整理汇总了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;
}
示例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());
}
});
}
示例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;
}
}
示例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]);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}