Пример #1
0
  public void dump(DumpContext ctx, int parameterizedJmfType) throws IOException {
    final CodecRegistry codecRegistry = ctx.getSharedContext().getCodecRegistry();

    int jmfType = codecRegistry.extractJmfType(parameterizedJmfType);

    if (jmfType != JMF_ARRAY_LIST)
      throw newBadTypeJMFEncodingException(jmfType, parameterizedJmfType);

    int indexOrLength = readIntData(ctx, (parameterizedJmfType >> 5) & 0x03, false);
    if ((parameterizedJmfType & 0x80) != 0) {
      String v = (String) ctx.getSharedObject(indexOrLength);
      ctx.indentPrintLn("<" + v + "@" + indexOrLength + ">");
      return;
    }

    String v = ArrayList.class.getName() + "[" + indexOrLength + "]";
    int indexOfStoredObject = ctx.addSharedObject(v);
    ctx.indentPrintLn(v + "@" + indexOfStoredObject + " {");
    ctx.incrIndent(1);

    for (int index = 0; index < indexOrLength; index++) {
      parameterizedJmfType = ctx.safeRead();
      jmfType = codecRegistry.extractJmfType(parameterizedJmfType);
      StandardCodec<?> codec = codecRegistry.getCodec(jmfType);

      if (codec == null) throw new JMFEncodingException("No codec for JMF type: " + jmfType);

      codec.dump(ctx, parameterizedJmfType);
    }

    ctx.incrIndent(-1);
    ctx.indentPrintLn("}");
  }