Write the class definition.
483390
private void writeClass() {

    if (writingAssocBean) {
      writer.append("/**").eol();
      writer.append(" * Association query bean for %s.", shortName).eol();
      writer.append(" * ").eol();
      writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
      writer.append(" */").eol();
      if (processingContext.isGeneratedAvailable()) {
        writer.append(AT_GENERATED).eol();
      }
      writer.append(AT_TYPEQUERYBEAN).eol();
      writer.append("public class Q%s<R> extends TQAssocBean<%s,R> {", shortName, origShortName).eol();

    } else {
      writer.append("/**").eol();
      writer.append(" * Query bean for %s.", shortName).eol();
      writer.append(" * ").eol();
      writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();
      writer.append(" */").eol();
      if (processingContext.isGeneratedAvailable()) {
        writer.append(AT_GENERATED).eol();
      }
      writer.append(AT_TYPEQUERYBEAN).eol();
      writer.append("public class Q%s extends TQRootBean<%1$s,Q%1$s> {", shortName).eol();
    }

    writer.eol();
  }
1356852
public void writeClassInit()
    {
        Record recClassInfo = this.getMainRecord();
        String strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
        if ("interface".equals(recClassInfo.getField(ClassInfo.CLASS_TYPE).toString()))
            return;
        if (this.readThisMethod(strClassName))
            this.writeThisMethod(CodeType.THICK);
        else
            this.writeThisMethod(CodeType.THICK);
    }
1087685
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(ANSI);
        result.write(ANSI_CODEPAGE);
        result.write(intToByteArray(1252));
        this.document.outputDebugLinebreak(result);    	
    }
138426
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(COLOR_RED);
        result.write(intToByteArray(red));
        result.write(COLOR_GREEN);
        result.write(intToByteArray(green));
        result.write(COLOR_BLUE);
        result.write(intToByteArray(blue));
        result.write(COLON);    	
    }
1251562
def describe(cls) -> None:
        
        max_lengths = []
        for attr_name in cls.attr_names():
            attr_func = "%ss" % attr_name
            attr_list = list(map(str, getattr(cls, attr_func)())) + [attr_name]
            max_lengths.append(max(list(map(len, attr_list))))
        row_format = "{:>%d} | {:>%d} | {:>%d}" % tuple(max_lengths)
        headers = [attr_name.capitalize() for attr_name in cls.attr_names()]
        header_line = row_format.format(*headers)
        output = "Class: %s\n" % cls.__name__
        output += header_line + "\n"
        output += "-"*(len(header_line)) + "\n"
        for item in cls:
            format_list = [str(getattr(item, attr_name))
                           for attr_name in cls.attr_names()]
            output += row_format.format(*format_list) + "\n"
        print(output)
420277
public void writeDefinition(final OutputStream result) throws IOException
    {
        result.write(PAGE_WIDTH);
        result.write(intToByteArray(pageWidth));
        result.write(PAGE_HEIGHT);
        result.write(intToByteArray(pageHeight));
        result.write(MARGIN_LEFT);
        result.write(intToByteArray(marginLeft));
        result.write(MARGIN_RIGHT);
        result.write(intToByteArray(marginRight));
        result.write(MARGIN_TOP);
        result.write(intToByteArray(marginTop));
        result.write(MARGIN_BOTTOM);
        result.write(intToByteArray(marginBottom));
        this.document.outputDebugLinebreak(result);    	
    }
1063514
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {

      out.write("public class " + getClassName(def) + " implements ConnectionMetaData");
      writeLeftCurlyBracket(out, 0);
      int indent = 1;

      writeDefaultConstructor(def, out, indent);

      writeEIS(def, out, indent);
      writeUsername(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
1244074
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      out.write("public interface " + getClassName(def));
      if (def.isAdminObjectImplRaAssociation())
      {
         out.write(" extends Referenceable, Serializable");
      }
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;
      writeConfigProps(def, out, indent);
      writeRightCurlyBracket(out, 0);
   }
443494
private function writeClassHeader(): void
  {
    $p = strrpos($this->wrapperClassName, '\\');
    if ($p!==false)
    {
      $namespace  = ltrim(substr($this->wrapperClassName, 0, $p), '\\');
      $class_name = substr($this->wrapperClassName, $p + 1);
    }
    else
    {
      $namespace  = null;
      $class_name = $this->wrapperClassName;
    }

    // Write PHP tag.
    $this->codeStore->append('<?php');

    // Write strict types.
    if ($this->strictTypes)
    {
      $this->codeStore->append('declare(strict_types=1);');
    }

    // Write name space of the wrapper class.
    if ($namespace!==null)
    {
      $this->codeStore->append('');
      $this->codeStore->append(sprintf('namespace %s;', $namespace));
      $this->codeStore->append('');
    }

    // If the child class and parent class have different names import the parent class. Otherwise use the fully
    // qualified parent class name.
    $parent_class_name = substr($this->parentClassName, strrpos($this->parentClassName, '\\') + 1);
    if ($class_name!=$parent_class_name)
    {
      $this->imports[]       = $this->parentClassName;
      $this->parentClassName = $parent_class_name;
    }

    // Write use statements.
    if (!empty($this->imports))
    {
      $this->imports = array_unique($this->imports, SORT_REGULAR);
      foreach ($this->imports as $import)
      {
        $this->codeStore->append(sprintf('use %s;', $import));
      }
      $this->codeStore->append('');
    }

    // Write class name.
    $this->codeStore->append('/**');
    $this->codeStore->append(' * The data layer.', false);
    $this->codeStore->append(' */', false);
    $this->codeStore->append(sprintf('class %s extends %s', $class_name, $this->parentClassName));
    $this->codeStore->append('{');
  }
650101
public void writeClass(String strClassName, CodeType codeType)
    {
        String strFieldClass;
        Record recClassInfo = this.getMainRecord();

        String strFieldDataHandle = this.getProperty(FieldData.FIELD_DATA_FILE);
        if (strFieldDataHandle != null)
        {
            FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
            try {
                recFieldData.setHandle(strFieldDataHandle, DBConstants.OBJECT_ID_HANDLE);  // Get the record
                String strRecordClass = recFieldData.getField(FieldData.FIELD_FILE_NAME).toString();
                String strFieldName = recFieldData.getField(FieldData.FIELD_NAME).toString();
                String strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).toString();
                m_BasedFieldHelper.getBasedField(recFieldData, strRecordClass, strFieldName, strBaseFieldName);  // Get the field this is based on
        
                String strClassInfoHandle = this.getProperty(ClassInfo.CLASS_INFO_FILE);
                if (strClassInfoHandle != null)
                    recClassInfo.setHandle(strClassInfoHandle, DBConstants.OBJECT_ID_HANDLE);  // Get the record
                else
                {   // Had to fake a class for this field
                    recClassInfo.addNew();
                    recClassInfo.getField(ClassInfo.CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_NAME).getFieldName()));
                    recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getFieldName()));
                    recClassInfo.getField(ClassInfo.CLASS_PACKAGE).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PACKAGE).getFieldName()));
                    recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getFieldName()));
                }
            } catch (DBException ex)    {
                ex.printStackTrace();
            }
        }
        strFieldClass = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();

        this.writeHeading(strFieldClass, this.getPackage(codeType), CodeType.THICK);   // Write the first few lines of the files
        this.writeIncludes(CodeType.THICK);

        if (m_MethodNameList.size() != 0)
            m_MethodNameList.removeAllElements();
    
        this.writeClassInterface();
    
        this.writeClassFields(CodeType.THICK);        // Write the C++ fields for this class
        this.writeDefaultConstructor(strFieldClass);
        this.writeFieldInit();
        this.writeInit();               // Special case... zero all class fields!
    
        this.writeInitField();
    
        this.writeClassMethods(CodeType.THICK);   // Write the remaining methods for this class
        this.writeEndCode(true);
    }
1211369
static void writeClassToFile(String className, ClassWriter classWriter, String apiName){
        classWriter.visitEnd();

        byte[] constructedClass = classWriter.toByteArray();

        try (FileOutputStream os = new FileOutputStream(new File(getFinalPathPart(className, apiName)))){
            os.write(constructedClass);
        } catch (IOException e) {
            throw new AsmException("Exception while writing generated classes to the .class files.", e);
        }
    }
1016595
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      if (def.isUseAnnotation())
      {
         if (!def.isDefaultPackageInbound())
         {
            out.write("@Activation(messageListeners = { " + def.getMlClass() + ".class })\n");
         }
         else
         {
            out.write("@Activation(messageListeners = { " + def.getRaPackage() +
                  ".inflow." + def.getMlClass() + ".class })\n");
         }
      }
      out.write("public class " + getClassName(def) + " implements ActivationSpec");
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;
      writeWithIndent(out, indent, "/** The logger */\n");
      writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");

      writeWithIndent(out, indent, "/** The resource adapter */\n");
      writeWithIndent(out, indent, "private ResourceAdapter ra;\n\n");

      writeConfigPropsDeclare(def, out, indent);

      writeDefaultConstructor(def, out, indent);

      writeConfigProps(def, out, indent);

      writeValidate(def, out, indent);
      writeResourceAdapter(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
908551
public void writeClass(String strClassName, CodeType codeType)
    {
        if (!this.readThisClass(strClassName))  // Get the field this is based on
            return;
    	boolean bResourceListBundle = ResourceTypeField.LIST_RESOURCE_BUNDLE.equals(this.getRecord(ProgramControl.PROGRAM_CONTROL_FILE).getField(ProgramControl.CLASS_RESOURCE_TYPE).toString());
    	String strFileName = strClassName;
    	if (!bResourceListBundle)
    		strFileName += ".properties";
        this.writeHeading(strFileName, this.getPackage(codeType), bResourceListBundle ? CodeType.RESOURCE_CODE : CodeType.RESOURCE_PROPERTIES);        // Write the first few lines of the files
    	if (bResourceListBundle)
    	{
	        this.writeIncludes(CodeType.THICK);
	        m_StreamOut.writeit("import java.util.*;\n");
	    
	        if (m_MethodNameList.size() != 0)
	            m_MethodNameList.removeAllElements();
	    
	        this.writeClassInterface();
	    
	        this.writeClassFields(CodeType.THICK);        // Write the C++ fields for this class
	
	        this.writeResources(strClassName);
	        this.writeMethodInterface(null, "getContents", "Object[][]", "", "", "Get the resource table", null);                   
	        m_StreamOut.writeit("\treturn contents;\n");
	        m_StreamOut.writeit("}\n");
	        this.writeClassMethods(CodeType.THICK);   // Write the remaining methods for this class
    	}
    	else
    	{
	        this.writeResources(strClassName);
    	}
        this.writeEndCode(bResourceListBundle);
    }
141716
public void writeClassFile(OutputStream out, ClassSymbol c)
        throws IOException, PoolOverflow, StringOverflow {
        Assert.check((c.flags() & COMPOUND) == 0);
        databuf.reset();
        poolbuf.reset();
        signatureGen.reset();
        pool = c.pool;
        innerClasses = null;
        innerClassesQueue = null;
        bootstrapMethods = new LinkedHashMap<>();

        Type supertype = types.supertype(c.type);
        List<Type> interfaces = types.interfaces(c.type);
        List<Type> typarams = c.type.getTypeArguments();

        int flags;
        if (c.owner.kind == MDL) {
            flags = ACC_MODULE;
        } else {
            flags = adjustFlags(c.flags() & ~DEFAULT);
            if ((flags & PROTECTED) != 0) flags |= PUBLIC;
            flags = flags & ClassFlags & ~STRICTFP;
            if ((flags & INTERFACE) == 0) flags |= ACC_SUPER;
        }

        if (dumpClassModifiers) {
            PrintWriter pw = log.getWriter(Log.WriterKind.ERROR);
            pw.println();
            pw.println("CLASSFILE  " + c.getQualifiedName());
            pw.println("---" + flagNames(flags));
        }
        databuf.appendChar(flags);

        if (c.owner.kind == MDL) {
            PackageSymbol unnamed = ((ModuleSymbol) c.owner).unnamedPackage;
            databuf.appendChar(pool.put(new ClassSymbol(0, names.module_info, unnamed)));
        } else {
            databuf.appendChar(pool.put(c));
        }
        databuf.appendChar(supertype.hasTag(CLASS) ? pool.put(supertype.tsym) : 0);
        databuf.appendChar(interfaces.length());
        for (List<Type> l = interfaces; l.nonEmpty(); l = l.tail)
            databuf.appendChar(pool.put(l.head.tsym));
        int fieldsCount = 0;
        int methodsCount = 0;
        for (Symbol sym : c.members().getSymbols(NON_RECURSIVE)) {
            switch (sym.kind) {
            case VAR: fieldsCount++; break;
            case MTH: if ((sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
                      break;
            case TYP: enterInner((ClassSymbol)sym); break;
            default : Assert.error();
            }
        }

        if (c.trans_local != null) {
            for (ClassSymbol local : c.trans_local) {
                enterInner(local);
            }
        }

        databuf.appendChar(fieldsCount);
        writeFields(c.members());
        databuf.appendChar(methodsCount);
        writeMethods(c.members());

        int acountIdx = beginAttrs();
        int acount = 0;

        boolean sigReq =
            typarams.length() != 0 || supertype.allparams().length() != 0;
        for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
            sigReq = l.head.allparams().length() != 0;
        if (sigReq) {
            int alenIdx = writeAttr(names.Signature);
            if (typarams.length() != 0) signatureGen.assembleParamsSig(typarams);
            signatureGen.assembleSig(supertype);
            for (List<Type> l = interfaces; l.nonEmpty(); l = l.tail)
                signatureGen.assembleSig(l.head);
            databuf.appendChar(pool.put(signatureGen.toName()));
            signatureGen.reset();
            endAttr(alenIdx);
            acount++;
        }

        if (c.sourcefile != null && emitSourceFile) {
            int alenIdx = writeAttr(names.SourceFile);
            // WHM 6/29/1999: Strip file path prefix.  We do it here at
            // the last possible moment because the sourcefile may be used
            // elsewhere in error diagnostics. Fixes 4241573.
            //databuf.appendChar(c.pool.put(c.sourcefile));
            String simpleName = PathFileObject.getSimpleName(c.sourcefile);
            databuf.appendChar(c.pool.put(names.fromString(simpleName)));
            endAttr(alenIdx);
            acount++;
        }

        if (genCrt) {
            // Append SourceID attribute
            int alenIdx = writeAttr(names.SourceID);
            databuf.appendChar(c.pool.put(names.fromString(Long.toString(getLastModified(c.sourcefile)))));
            endAttr(alenIdx);
            acount++;
            // Append CompilationID attribute
            alenIdx = writeAttr(names.CompilationID);
            databuf.appendChar(c.pool.put(names.fromString(Long.toString(System.currentTimeMillis()))));
            endAttr(alenIdx);
            acount++;
        }

        acount += writeFlagAttrs(c.flags());
        acount += writeJavaAnnotations(c.getRawAttributes());
        acount += writeTypeAnnotations(c.getRawTypeAttributes(), false);
        acount += writeEnclosingMethodAttribute(c);
        if (c.owner.kind == MDL) {
            acount += writeModuleAttribute(c);
            acount += writeFlagAttrs(c.owner.flags() & ~DEPRECATED);
        }
        acount += writeExtraClassAttributes(c);

        poolbuf.appendInt(JAVA_MAGIC);

        if (c.owner.kind == MDL) {
            // temporarily overide to force use of v53 for module-info.class
            poolbuf.appendChar(0);
            poolbuf.appendChar(53);
        } else {
            poolbuf.appendChar(target.minorVersion);
            poolbuf.appendChar(target.majorVersion);
        }

        writePool(c.pool);

        if (innerClasses != null) {
            writeInnerClasses();
            acount++;
        }

        if (!bootstrapMethods.isEmpty()) {
            writeBootstrapMethods();
            acount++;
        }

        endAttrs(acountIdx, acount);

        poolbuf.appendBytes(databuf.elems, 0, databuf.length);
        out.write(poolbuf.elems, 0, poolbuf.length);

        pool = c.pool = null; // to conserve space
     }
579104
public static void writeConfigFile(OutputStream outputStream, Class<?>[] classes, boolean sortClasses)
			throws SQLException, IOException {
		if (sortClasses) {
			// sort our class list to make the output more deterministic
			Class<?>[] sortedClasses = new Class<?>[classes.length];
			System.arraycopy(classes, 0, sortedClasses, 0, classes.length);
			Arrays.sort(sortedClasses, classComparator);
			classes = sortedClasses;
		}
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream), 4096);
		try {
			writeHeader(writer);
			for (Class<?> clazz : classes) {
				writeConfigForTable(writer, clazz, sortClasses);
			}
			// NOTE: done is here because this is public
			System.out.println("Done.");
		} finally {
			writer.close();
		}
	}
825979
void write(ByteCodeWriter out)
    throws IOException
  {
    out.write(ConstantPool.CP_FIELD_REF);
    out.writeShort(_classIndex);
    out.writeShort(_nameAndTypeIndex);
  }
1120719
public void writeLoaderClasses() throws IOException {
        URL loaderJar = getClass().getClassLoader().getResource(NESTED_LOADER_JAR);
        JarInputStream inputStream = new JarInputStream(
                new BufferedInputStream(loaderJar.openStream()));
        JarEntry entry;
        while ((entry = inputStream.getNextJarEntry()) != null) {
            if (entry.getName().endsWith(".class")) {
                writeEntry(entry, new InputStreamEntryWriter(inputStream, false));
            }
        }
        inputStream.close();
    }