Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

public class Main {
    public static <T> T getParcelable(@NonNull byte[] bytes, Parcelable.Creator<T> creator) {
        if (bytes == null || creator == null) {
            return null;
        }
        return creator.createFromParcel(unmarshall(bytes));
    }

    private static Parcel unmarshall(byte[] bytes) {
        Parcel parcel = Parcel.obtain();
        parcel.unmarshall(bytes, 0, bytes.length);
        parcel.setDataPosition(0);
        return parcel;
    }
}