Methods Summary |
---|
public void | _parseDetails(java.nio.ByteBuffer content)
parseChildBoxes(content);
|
public void | addBox(com.coremedia.iso.boxes.Box b)Add b to the container and sets the parent correctly.
b.setParent(this);
boxes.add(b);
|
public java.util.List | getBoxes()
return Collections.unmodifiableList(boxes);
|
public java.util.List | getBoxes(java.lang.Class clazz)
return getBoxes(clazz, false);
|
public java.util.List | getBoxes(java.lang.Class clazz, boolean recursive)
List<T> boxesToBeReturned = new ArrayList<T>(2);
for (Box boxe : boxes) {
//clazz.isInstance(boxe) / clazz == boxe.getClass()?
// I hereby finally decide to use isInstance
if (clazz.isInstance(boxe)) {
boxesToBeReturned.add((T) boxe);
}
if (recursive && boxe instanceof ContainerBox) {
boxesToBeReturned.addAll(((ContainerBox) boxe).getBoxes(clazz, recursive));
}
}
return boxesToBeReturned;
|
protected void | getContent(java.nio.ByteBuffer byteBuffer)
writeChildBoxes(byteBuffer);
|
protected long | getContentSize()
long contentSize = 0;
for (Box boxe : boxes) {
contentSize += boxe.getSize();
}
return contentSize;
|
public long | getNumOfBytesToFirstChild()The number of bytes from box start (first length byte) to the
first length byte of the first child box
return 8;
|
public void | parse(java.nio.channels.ReadableByteChannel readableByteChannel, java.nio.ByteBuffer header, long contentSize, com.coremedia.iso.BoxParser boxParser)
super.parse(readableByteChannel, header, contentSize, boxParser);
this.boxParser = boxParser;
|
protected final void | parseChildBoxes(java.nio.ByteBuffer content)
try {
while (content.remaining() >= 8) { // 8 is the minimal size for a sane box
boxes.add(boxParser.parseBox(new ByteBufferByteChannel(content), this));
}
if (content.remaining() != 0) {
setDeadBytes(content.slice());
LOG.warning("Something's wrong with the sizes. There are dead bytes in a container box.");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
|
public void | removeBox(com.coremedia.iso.boxes.Box b)
b.setParent(this);
boxes.remove(b);
|
public void | setBoxes(java.util.List boxes)
this.boxes = new LinkedList<Box>(boxes);
|
public java.lang.String | toString()
StringBuilder buffer = new StringBuilder();
buffer.append(this.getClass().getSimpleName()).append("[");
for (int i = 0; i < boxes.size(); i++) {
if (i > 0) {
buffer.append(";");
}
buffer.append(boxes.get(i).toString());
}
buffer.append("]");
return buffer.toString();
|
protected final void | writeChildBoxes(java.nio.ByteBuffer bb)
WritableByteChannel wbc = new ByteBufferByteChannel(bb);
for (Box box : boxes) {
try {
box.getBox(wbc);
} catch (IOException e) {
// My WritableByteChannel won't throw any excpetion
throw new RuntimeException("Cannot happen to me", e);
}
}
|