public static Box parseChildBox(ByteBuffer input, BoxFactory factory) { ByteBuffer fork = input.duplicate(); while (input.remaining() >= 4 && fork.getInt() == 0) input.getInt(); if (input.remaining() < 4) return null; Header childAtom = Header.read(input); if (childAtom != null && input.remaining() >= childAtom.getBodySize()) return parseBox(NIOUtils.read(input, (int) childAtom.getBodySize()), childAtom, factory); else return null; }
public void parse(ByteBuffer input) { data = NIOUtils.read(input, (int) header.getBodySize()); }
public static Box parseChildBox(ByteBuffer input, BoxFactory factory) { ByteBuffer fork = input.duplicate(); while (input.remaining() >= 4 && fork.getInt() == 0) input.getInt(); if (input.remaining() < 4) return null; Header childAtom = Header.read(input); if (childAtom != null && input.remaining() >= childAtom.getBodySize()) return parseBox(NIOUtils.read(input, (int) childAtom.getBodySize()), childAtom, factory); else return null; }
public void parse(ByteBuffer input) { data = NIOUtils.read(input, (int) header.getBodySize()); }
public void parse(ByteBuffer input) { data = NIOUtils.read(input, (int) header.getBodySize()); }
public static Box parseChildBox(ByteBuffer input, IBoxFactory factory) { ByteBuffer fork = input.duplicate(); while (input.remaining() >= 4 && fork.getInt() == 0) input.getInt(); if (input.remaining() < 4) return null; Box ret = null; Header childAtom = Header.read(input); if (childAtom != null && input.remaining() >= childAtom.getBodySize()) { ret = Box.parseBox(NIOUtils.read(input, (int) childAtom.getBodySize()), childAtom, factory); } return ret; }
public static Box parseChildBox(ByteBuffer input, IBoxFactory factory) { ByteBuffer fork = input.duplicate(); while (input.remaining() >= 4 && fork.getInt() == 0) input.getInt(); if (input.remaining() < 4) return null; Header childAtom = Header.read(input); if (childAtom != null && input.remaining() >= childAtom.getBodySize()) return parseBox(NIOUtils.read(input, (int) childAtom.getBodySize()), childAtom, factory); else return null; }
public void parse(ByteBuffer input) { while (input.remaining() >= 4) { int size = input.getInt(); ByteBuffer local = NIOUtils.read(input, size - 4); int index = local.getInt(); List<Box> children = new ArrayList<Box>(); values.put(index, children); while (local.hasRemaining()) { Header childAtom = Header.read(local); if (childAtom != null && local.remaining() >= childAtom.getBodySize()) { Box box = Box.parseBox(NIOUtils.read(local, (int) childAtom.getBodySize()), childAtom, factory); children.add(box); } } } }
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)); } }
public Box parseBox(SeekableByteChannel input) throws IOException { input.setPosition(offset + header.headerSize()); return BoxUtil.parseBox(NIOUtils.fetchFromChannel(input, (int) header.getBodySize()), header, BoxFactory.getDefault()); }