added reuse option for root objects

getRootAs..() function now has a second implementation that
accepts an existing object to allow object reuse, much like
all other methods that refer to objects.

Change-Id: Iffef567c903a130761ef7de98867e5465d29a04d
This commit is contained in:
Florian Enner
2015-01-30 17:09:59 -05:00
committed by Wouter van Oortmerssen
parent 4d3db99283
commit b0910e75e0
5 changed files with 19 additions and 10 deletions

View File

@@ -8,7 +8,8 @@ import java.util.*;
import com.google.flatbuffers.*;
public class Stat extends Table {
public static Stat getRootAsStat(ByteBuffer _bb) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (new Stat()).__init(_bb.getInt(_bb.position()) + _bb.position(), _bb); }
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public Stat __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }