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

    DataInputStream saved = istream;
    int sizeLimit = getHeader().length + (0);
    if (sizeLimit > 0) {
      byte[] ba = new byte[sizeLimit];
      istream.readFully(ba);
      ByteArrayInputStream baTemp = new ByteArrayInputStream(ba);
      istream = new DataInputStream(baTemp);
      {
        // read desc_header
        retVal += desc_header.read(istream);
        // read service_id
        {
          service_id = BinPrimitive.readUI24(istream);
          retVal += 3;
        }
        // read bf1
        retVal += bf1.read(istream);
        // read service_name
        {
          retVal += service_name.read(istream);
        }
      }
    }
    istream = saved;
    postRead();
    return retVal;
  }
  public int write(DataOutputStream ostream) throws IOException {
    preWrite();
    int retVal = 0;

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

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

    // write desc_header
    if (desc_header != null) retVal += desc_header.write(ostream);
    // write service_id
    {
      ostream.writeByte((service_id & 0x00FF0000) >> 16);
      ostream.writeShort((service_id & 0x0000FFFF));
      retVal += 3;
    }
    // write bf1
    ostream.writeByte(bf1.getValue());
    retVal += 1;
    // write service_name
    {
      retVal += service_name.write(ostream);
    }
    postWrite();
    return retVal;
  }
  private void init() {
    // Initialize desc_header
    desc_header = new descriptor_header();
    // Initialize service_id

    // Initialize bf1
    bf1 = new BitField_8();
    // Initialize service_name
    service_name = new ByteArray();
    service_name.setSizeType("EOS");
  }
 public int dump(DumpContext dc) throws IOException {
   dc.indent();
   dc.getPs().print("abstract_service_descriptor\n");
   dc.increaseIndent();
   int retVal = 0;
   // write desc_header
   if (desc_header != null) {
     dc.indent();
     dc.getPs().println("desc_header");
     retVal += desc_header.dump(dc);
   }
   // write service_id
   dc.indent();
   dc.getPs().println("service_id=" + service_id + "(0x" + Integer.toHexString(service_id) + ")");
   // write bf1
   {
     dc.indent();
     dc.getPs().print("reserved: ");
     dc.getPs().println(BitField_8.toDisplayString(getReserved(), 7));
     dc.indent();
     dc.getPs().print("auto_select: ");
     dc.getPs().println(BitField_8.toDisplayString(getAuto_select(), 5));
   }
   // write service_name
   dc.indent();
   dc.getPs()
       .print(
           "service_name: "
               + service_name.getSize()
               + "(0x"
               + Integer.toHexString(service_name.getSize())
               + ")\n");
   this.service_name.dump(dc);
   dc.decreaseIndent();
   return retVal;
 }