public int write(DataOutputStream ostream) throws IOException { preWrite(); int retVal = 0; { /** fix dependent sizes for header * */ } { /** fix dependent sizes for resources * */ } { /** fix dependent sizes for pvData * */ } { /** fix dependent sizes for cvCertificates* */ certificateCount = (short) (cvCertificates.getCount() - (0)); } // write header if (header != null) retVal += header.write(ostream); // write protocol_version ostream.writeByte(protocol_version); retVal += 1; // write configuration_count_change ostream.writeByte(configuration_count_change); retVal += 1; // write resources if (resources != null) retVal += resources.write(ostream); // write pvData if (pvData != null) retVal += pvData.write(ostream); // write certificateCount ostream.writeByte(certificateCount); retVal += 1; // write cvCertificates { ArrayList<CVCertificate> temp1 = cvCertificates; for (int iIdx = 0; iIdx < temp1.getCount(); iIdx++) { CVCertificate temp2 = temp1.get(iIdx); if (temp2 != null) retVal += temp2.write(ostream); } } postWrite(); return retVal; }
public int read(DataInputStream istream) throws IOException { preRead(); int retVal = 0; // read header retVal += header.read(istream); // read protocol_version { protocol_version = (short) (istream.readUnsignedByte()); retVal += 1; } // read configuration_count_change { configuration_count_change = (short) (istream.readUnsignedByte()); retVal += 1; } // read resources retVal += resources.read(istream); // read pvData { IntegerHolder iHolder = new IntegerHolder(); DataInputStream disTemp = istream; pvData = PVDataFactory.createMsg(protocol_version, disTemp, iHolder); retVal += iHolder.getValue(); } // read certificateCount { certificateCount = (short) (istream.readUnsignedByte()); retVal += 1; } // read cvCertificates for (int iIdx = 0; iIdx < certificateCount + (0); iIdx++) { CVCertificate temp; temp = new CVCertificate(); retVal += temp.read(istream); cvCertificates.add(temp); } postRead(); return retVal; }
public int dump(DumpContext dc) throws IOException { dc.indent(); dc.getPs().print("code_version_table2_\n"); dc.increaseIndent(); int retVal = 0; // write header if (header != null) { dc.indent(); dc.getPs().println("header"); retVal += header.dump(dc); } // write protocol_version dc.indent(); dc.getPs() .println( "protocol_version=" + protocol_version + "(0x" + Integer.toHexString(protocol_version) + ")"); // write configuration_count_change dc.indent(); dc.getPs() .println( "configuration_count_change=" + configuration_count_change + "(0x" + Integer.toHexString(configuration_count_change) + ")"); // write resources if (resources != null) { dc.indent(); dc.getPs().println("resources"); retVal += resources.dump(dc); } // write pvData if (pvData != null) { dc.indent(); dc.getPs().println("pvData"); retVal += pvData.dump(dc); } // write certificateCount dc.indent(); dc.getPs() .println( "certificateCount=" + certificateCount + "(0x" + Integer.toHexString(certificateCount) + ")"); // write cvCertificates { ArrayList<CVCertificate> temp1 = cvCertificates; for (int iIdx = 0; iIdx < temp1.getCount(); iIdx++) { CVCertificate 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; }