Java tutorial
//package com.java2s; /* * Copyright (C) 2014 Ingenic Semiconductor * * SunWenZhong(Fighter) <wenzhong.sun@ingenic.com, wanmyqawdr@126.com> * * Elf/IDWS Project * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. * */ import android.os.Parcel; import android.os.Parcelable; public class Main { public static Parcel unmarshall(byte[] bytes) { Parcel parcel = Parcel.obtain(); parcel.unmarshall(bytes, 0, bytes.length); parcel.setDataPosition(0); return parcel; } public static <T> T unmarshall(byte[] bytes, Parcelable.Creator<T> creator) { Parcel parcel = unmarshall(bytes); T obj = creator.createFromParcel(parcel); parcel.recycle(); return obj; } }