public static <T extends Box> T as(Class<T> class1, Box.LeafBox box) { try { T res = class1.getConstructor(Header.class).newInstance(box.getHeader()); res.parse(box.getData().duplicate()); return res; } catch (Exception e) { throw new RuntimeException(e); } }
public static <T extends Box> T as(Class<T> class1, LeafBox box) { try { T res = class1.getConstructor(Header.class).newInstance(box.getHeader()); res.parse(box.getData()); return res; } catch (Exception e) { throw new RuntimeException(e); } } }
public static <T extends Box> T as(Class<T> class1, LeafBox box) { try { T res = class1.getConstructor(Header.class).newInstance(box.getHeader()); res.parse(box.getData()); return res; } catch (Exception e) { throw new RuntimeException(e); } } }
public static <T extends Box> T asBox(Class<T> class1, Box box) { try { T res = Platform.newInstance(class1, new Object[]{box.getHeader()}); ByteBuffer buffer = ByteBuffer.allocate((int)box.getHeader().getBodySize()); box.doWrite(buffer); buffer.flip(); res.parse(buffer); return res; } catch (Exception e) { throw new RuntimeException(e); } }
public static Box parseBox(ByteBuffer input, Header childAtom, IBoxFactory factory) { Box box = factory.newBox(childAtom); if (childAtom.getBodySize() < Box.MAX_BOX_SIZE) { box.parse(input); return box; } else { return new LeafBox(Header.createHeader("free", 8)); } }
public static Box parseBox(ByteBuffer input, Header childAtom, IBoxFactory factory) { Box box = factory.newBox(childAtom); if (childAtom.getBodySize() < Box.MAX_BOX_SIZE) { box.parse(input); return box; } else { return new Box.LeafBox(Header.createHeader("free", 8)); } }
public static Box parseBox(ByteBuffer input, Header childAtom, BoxFactory factory) { Box box = newBox(childAtom, factory); if (childAtom.getBodySize() < MAX_BOX_SIZE) { box.parse(input); return box; } else { return new LeafBox(new Header("free", 8)); } }
public static Box parseBox(ByteBuffer input, Header childAtom, BoxFactory factory) { Box box = newBox(childAtom, factory); if (childAtom.getBodySize() < MAX_BOX_SIZE) { box.parse(input); return box; } else { return new LeafBox(new Header("free", 8)); } }