public <T extends FSTStruct> StructArray<T> toStructArray(int size, T onHeap) { StructArray<T> arr = new StructArray<T>(size,onHeap); return toStruct(arr); }
public <T extends FSTStruct> StructArray<T> toStructArray(int size, T onHeap) { StructArray<T> arr = new StructArray<T>(size,onHeap); return toStruct(arr); }
/** * create a new struct array of same type as template * @param size * @return */ public <X extends FSTStruct> StructArray<X> newArray(int size, X templ, BytezAllocator alloc) { StructArray<X> aTemplate = new StructArray<X>(size, templ); int siz = getFactory().calcStructSize(aTemplate); try { if ( siz < chunkSize ) return newStruct(aTemplate); else { return getFactory().toStruct(aTemplate,alloc); } } catch (Throwable e) { throw new RuntimeException(e); } }
/** * create a new struct array of same type as template * @param size * @return */ public <X extends FSTStruct> StructArray<X> newArray(int size, X templ, BytezAllocator alloc) { StructArray<X> aTemplate = new StructArray<X>(size, templ); int siz = getFactory().calcStructSize(aTemplate); try { if ( siz < chunkSize ) return newStruct(aTemplate); else { return getFactory().toStruct(aTemplate,alloc); } } catch (Throwable e) { throw new RuntimeException(e); } }