public int read(DataInputStream istream) throws IOException {
    preRead();
    int retVal = 0;

    // read header
    retVal += header.read(istream);
    // read length
    {
      length = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read programIndex
    {
      programIndex = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read txnId
    {
      txnId = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read ltsid
    {
      ltsid = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read programNumber
    {
      programNumber = istream.readUnsignedShort();
      retVal += 2;
    }
    // read sourceId
    {
      sourceId = istream.readUnsignedShort();
      retVal += 2;
    }
    // read caPmtCmdId
    {
      caPmtCmdId = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read bf2
    retVal += bf2.read(istream);
    // read StatusfieldCheckInstance
    if (getProgramInfoLength() != 0) {
      StatusfieldCheckInstance = new StatusfieldCheck(this);
      retVal += StatusfieldCheckInstance.read(istream);
    }
    // read CaEntries
    for (; istream.available() > 0; ) {
      CaPmtModeMsg temp;
      temp = new CaPmtModeMsg();
      retVal += temp.read(istream);
      CaEntries.add(temp);
    }

    postRead();
    return retVal;
  }
  public int write(DataOutputStream ostream) throws IOException {
    preWrite();
    int retVal = 0;

    {
      /** fix dependent sizes for header * */
    }

    {
      /** fix dependent sizes for StatusfieldCheckInstance * */
    }
    {
      /** fix dependent sizes for CaEntries* */
    }

    // write header
    if (header != null) retVal += header.write(ostream);
    // write length
    ostream.writeByte(length);
    retVal += 1;
    // write programIndex
    ostream.writeByte(programIndex);
    retVal += 1;
    // write txnId
    ostream.writeByte(txnId);
    retVal += 1;
    // write ltsid
    ostream.writeByte(ltsid);
    retVal += 1;
    // write programNumber
    ostream.writeShort(programNumber);
    retVal += 2;
    // write sourceId
    ostream.writeShort(sourceId);
    retVal += 2;
    // write caPmtCmdId
    ostream.writeByte(caPmtCmdId);
    retVal += 1;
    // write bf2
    ostream.writeShort(bf2.getValue());
    retVal += 2;
    // write StatusfieldCheckInstance
    if (StatusfieldCheckInstance != null) retVal += StatusfieldCheckInstance.write(ostream);
    // write CaEntries
    {
      ArrayList<CaPmtModeMsg> temp1 = CaEntries;
      for (int iIdx = 0; iIdx < temp1.getCount(); iIdx++) {
        CaPmtModeMsg temp2 = temp1.get(iIdx);
        if (temp2 != null) retVal += temp2.write(ostream);
      }
    }
    postWrite();
    return retVal;
  }
  public int readNoHeader(DataInputStream istream) throws IOException {

    preRead();
    int retVal = 0;
    // read length
    {
      length = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read caPmtlisMngement
    {
      caPmtlisMngement = (short) (istream.readUnsignedByte());
      retVal += 1;
    }
    // read programNumber
    {
      programNumber = istream.readUnsignedShort();
      retVal += 2;
    }
    // read bf1
    retVal += bf1.read(istream);
    // read bf2
    retVal += bf2.read(istream);
    // read StatusfieldCheckInstance
    if (getProgramInfoLength() != 0) {
      StatusfieldCheckInstance = new StatusfieldCheck(this);
      retVal += StatusfieldCheckInstance.read(istream);
    }
    // read CaEntries
    for (; istream.available() > 0; ) {
      CaPmtModeMsg temp;
      temp = new CaPmtModeMsg();
      retVal += temp.read(istream);
      CaEntries.add(temp);
    }

    postRead();
    return retVal;
  }
 public int dump(DumpContext dc) throws IOException {
   dc.indent();
   dc.getPs().print("CaPmtMMode2_1\n");
   dc.increaseIndent();
   int retVal = 0;
   // write header
   if (header != null) {
     dc.indent();
     dc.getPs().println("header");
     retVal += header.dump(dc);
   }
   // write length
   dc.indent();
   dc.getPs().println("length=" + length + "(0x" + Integer.toHexString(length) + ")");
   // write programIndex
   dc.indent();
   dc.getPs()
       .println("programIndex=" + programIndex + "(0x" + Integer.toHexString(programIndex) + ")");
   // write txnId
   dc.indent();
   dc.getPs().println("txnId=" + txnId + "(0x" + Integer.toHexString(txnId) + ")");
   // write ltsid
   dc.indent();
   dc.getPs().println("ltsid=" + ltsid + "(0x" + Integer.toHexString(ltsid) + ")");
   // write programNumber
   dc.indent();
   dc.getPs()
       .println(
           "programNumber=" + programNumber + "(0x" + Integer.toHexString(programNumber) + ")");
   // write sourceId
   dc.indent();
   dc.getPs().println("sourceId=" + sourceId + "(0x" + Integer.toHexString(sourceId) + ")");
   // write caPmtCmdId
   dc.indent();
   dc.getPs().println("caPmtCmdId=" + caPmtCmdId + "(0x" + Integer.toHexString(caPmtCmdId) + ")");
   // write bf2
   {
     dc.indent();
     dc.getPs().print("reserved: ");
     dc.getPs().println(BitField_8.toDisplayString(getReserved(), 5));
     dc.indent();
     dc.getPs().print("programInfoLength: ");
     dc.getPs().println(BitField_8.toDisplayString(getProgramInfoLength(), 12));
   }
   // write StatusfieldCheckInstance
   if (StatusfieldCheckInstance != null) {
     dc.indent();
     dc.getPs().println("StatusfieldCheckInstance");
     retVal += StatusfieldCheckInstance.dump(dc);
   }
   // write CaEntries
   {
     ArrayList<CaPmtModeMsg> temp1 = CaEntries;
     for (int iIdx = 0; iIdx < temp1.getCount(); iIdx++) {
       CaPmtModeMsg element = temp1.get(iIdx);
       dc.indent();
       dc.getPs().println(iIdx);
       if (element != null) {
         dc.indent();
         dc.getPs().println("element");
         retVal += element.dump(dc);
       }
     }
   }
   dc.decreaseIndent();
   return retVal;
 }
 public int dump(DumpContext dc) throws IOException {
   dc.indent();
   dc.getPs().print("CaPmtSMode1_2\n");
   dc.increaseIndent();
   int retVal = 0;
   // write header
   if (header != null) {
     dc.indent();
     dc.getPs().println("header");
     retVal += header.dump(dc);
   }
   // write length
   dc.indent();
   dc.getPs().println("length=" + length + "(0x" + Integer.toHexString(length) + ")");
   // write caPmtlisMngement
   dc.indent();
   dc.getPs()
       .println(
           "caPmtlisMngement="
               + caPmtlisMngement
               + "(0x"
               + Integer.toHexString(caPmtlisMngement)
               + ")");
   // write programNumber
   dc.indent();
   dc.getPs()
       .println(
           "programNumber=" + programNumber + "(0x" + Integer.toHexString(programNumber) + ")");
   // write bf1
   {
     dc.indent();
     dc.getPs().print("reserved1: ");
     dc.getPs().println(BitField_8.toDisplayString(getReserved1(), 2));
     dc.indent();
     dc.getPs().print("versionNumber: ");
     dc.getPs().println(BitField_8.toDisplayString(getVersionNumber(), 5));
     dc.indent();
     dc.getPs().print("currentNext: ");
     dc.getPs().println(BitField_8.toDisplayString(getCurrentNext(), 1));
   }
   // write bf2
   {
     dc.indent();
     dc.getPs().print("reserved: ");
     dc.getPs().println(BitField_8.toDisplayString(getReserved(), 5));
     dc.indent();
     dc.getPs().print("programInfoLength: ");
     dc.getPs().println(BitField_8.toDisplayString(getProgramInfoLength(), 12));
   }
   // write StatusfieldCheckInstance
   if (StatusfieldCheckInstance != null) {
     dc.indent();
     dc.getPs().println("StatusfieldCheckInstance");
     retVal += StatusfieldCheckInstance.dump(dc);
   }
   // write CaEntries
   {
     ArrayList<CaPmtModeMsg> temp1 = CaEntries;
     for (int iIdx = 0; iIdx < temp1.getCount(); iIdx++) {
       CaPmtModeMsg element = temp1.get(iIdx);
       dc.indent();
       dc.getPs().println(iIdx);
       if (element != null) {
         dc.indent();
         dc.getPs().println("element");
         retVal += element.dump(dc);
       }
     }
   }
   dc.decreaseIndent();
   return retVal;
 }