Write the constants for the field offsets
@param codeType
554582
public void writeFieldOffsets(FieldIterator fieldIterator, CodeType codeType)
    { // Now, write all the field offsets out in the header file
        ClassInfo recClassInfo = (ClassInfo)this.getMainRecord();
        boolean firstTime = true;
        String strBaseFieldName;
        String strFieldName = "MainField";     // In case there are no fields
        Record recFieldData = this.getRecord(FieldData.FIELD_DATA_FILE);

        boolean alwaysInclude = false;
        boolean alwaysExclude = false;
        if (recClassInfo.isARecord(false))
        {   // For record, all the fields are in the model class
            if (codeType == CodeType.INTERFACE)
                alwaysInclude = true;
            else
                alwaysExclude = true;
        }
        else
        {   // screen record are thick only - no model
            if (codeType == CodeType.THICK)
                alwaysInclude = true;
            else
                alwaysExclude = true;
        }
        for (int pass = 1; pass <= 2; ++pass) // Do this two times (two passes)
        {
            fieldIterator.close();
            while (fieldIterator.hasNext())
            {
                fieldIterator.next();
                strFieldName = recFieldData.getField(FieldData.FIELD_NAME).getString();
                strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).getString();
                String type = "String";
                switch (pass)
                {
                case 1:     // First, add all fields based on the super.New8 class
                    if (strBaseFieldName.length() > 0)
                    {
                        firstTime = false;
                        String value = convertNameToConstant(strBaseFieldName);
                        String strPre = DBConstants.BLANK;
                        if (recFieldData.getField(FieldData.FIELD_NAME).getString().equals(strBaseFieldName))
                            strPre = "//";
                        strFieldName = convertNameToConstant(strFieldName);
                        boolean includeThis = ((IncludeScopeField)recFieldData.getField(FieldData.INCLUDE_SCOPE)).includeThis(codeType, true);
                        if (alwaysInclude)
                            includeThis = true;
                        if (alwaysExclude)
                            includeThis = false;
                        if (includeThis)
                            m_StreamOut.writeit("\n" + strPre + "public static final " + type + " " + strFieldName + " = " + value + ";");
                    }
                    break;
                case 2:     // Now, add all fields new to this class
                    if (strBaseFieldName.length() == 0)
                    {
                        firstTime = false;
                        boolean includeThis = ((IncludeScopeField)recFieldData.getField(FieldData.INCLUDE_SCOPE)).includeThis(codeType, true);
                        if (alwaysInclude)
                            includeThis = true;
                        if (alwaysExclude)
                            includeThis = false;
                        if (Rec.ID.equals(strFieldName))
                            includeThis = false;    // HACK
                        if (includeThis)
                            m_StreamOut.writeit("\n" + "public static final String " + this.convertNameToConstant(strFieldName) + " = \"" + strFieldName + "\";");
                        break;
                    }
                }
            }
            recFieldData.close();
            if (pass == 2)
            {
                if (!firstTime)
                    m_StreamOut.writeit("\n");
            }
        } // End of pass loop
        
    }
825979
void write(ByteCodeWriter out)
    throws IOException
  {
    out.write(ConstantPool.CP_FIELD_REF);
    out.writeShort(_classIndex);
    out.writeShort(_nameAndTypeIndex);
  }
348477
public void write(EnumType type) throws XMLStreamException {

        LOG.debug("Writing type {} of type {}", type.getName(), type.getMetaType());

        xmlWriter.writeStartElement(ENUM_TYPE);
        xmlWriter.writeAttribute(NAME, type.getName());
        for (EnumMember member : type.getMembers()) {
            xmlWriter.writeStartElement(ENUM_MEMBER);
            xmlWriter.writeAttribute(NAME, member.getName());
            xmlWriter.writeEndElement();
        }
        xmlWriter.writeEndElement();
    }
332803
private void writeTypedUInt(final int type, final long value)
    {
        if (value <= 0xFFL)
        {
            updateLength(2);
            buffer.writeUInt8(type | 0x01);
            buffer.writeUInt8(value);
        }
        else if (value <= 0xFFFFL)
        {
            updateLength(3);
            buffer.writeUInt8(type | 0x02);
            buffer.writeUInt16(value);
        }
        else if (value <= 0xFFFFFFL)
        {
            updateLength(4);
            buffer.writeUInt8(type | 0x03);
            buffer.writeUInt24(value);
        }
        else if (value <= 0xFFFFFFFFL)
        {
            updateLength(5);
            buffer.writeUInt8(type | 0x04);
            buffer.writeUInt32(value);
        }
        else if (value <= 0xFFFFFFFFFFL)
        {
            updateLength(6);
            buffer.writeUInt8(type | 0x05);
            buffer.writeUInt40(value);
        }
        else if (value <= 0xFFFFFFFFFFFFL)
        {
            updateLength(7);
            buffer.writeUInt8(type | 0x06);
            buffer.writeUInt48(value);
        }
        else if (value <= 0xFFFFFFFFFFFFFFL)
        {
            updateLength(8);
            buffer.writeUInt8(type | 0x07);
            buffer.writeUInt56(value);
        }
        else
        {
            updateLength(9);
            buffer.writeUInt8(type | 0x08);
            buffer.writeUInt64(value);
        }
    }
1174169
public void writeGeneric( Object value )
    {
        if (value == null)
            write(NULL_VALUE);
        else
        {
            if (value instanceof String)
            {
                writeByte(TYPE_STRING);
                writeUTF((String)value);
            }
            else if (value instanceof Boolean)
            {
                writeByte(TYPE_BOOLEAN);
                writeBoolean(((Boolean)value).booleanValue());
            }
            else if (value instanceof Byte)
            {
                writeByte(TYPE_BYTE);
                writeByte(((Byte)value).byteValue());
            }
            else if (value instanceof Short)
            {
                writeByte(TYPE_SHORT);
                writeShort(((Short)value).shortValue());
            }
            else if (value instanceof Integer)
            {
                writeByte(TYPE_INT);
                writeInt(((Integer)value).intValue());
            }
            else if (value instanceof Long)
            {
                writeByte(TYPE_LONG);
                writeLong(((Long)value).longValue());
            }
            else if (value instanceof Float)
            {
                writeByte(TYPE_FLOAT);
                writeFloat(((Float)value).floatValue());
            }
            else if (value instanceof Double)
            {
                writeByte(TYPE_DOUBLE);
                writeDouble(((Double)value).doubleValue());
            }
            else if (value instanceof byte[])
            {
                writeByte(TYPE_BYTEARRAY);
                writeByteArray((byte[])value);
            }
            else if (value instanceof Character)
            {
                writeByte(TYPE_CHARACTER);
                writeChar(((Character)value).charValue());
            }
            else
                throw new IllegalArgumentException("Unsupported type : "+value.getClass().getName());
        }
93242
public static void writeObject(CodedOutputStream out, int order, FieldType type, Object o, boolean list,
            boolean withTag) throws IOException {
        if (o == null) {
            return;
        }

        if (type == FieldType.OBJECT) {

            Class cls = o.getClass();
            Codec target = ProtobufProxy.create(cls);

            if (withTag) {
                out.writeRawVarint32(makeTag(order, WireFormat.WIRETYPE_LENGTH_DELIMITED));
            }
            out.writeRawVarint32(target.size(o));

            target.writeTo(o, out);
            return;
        }

        if (type == FieldType.BOOL) {
            if (withTag) {
                out.writeBool(order, (Boolean) o);
            } else {
                out.writeBoolNoTag((Boolean) o);
            }
        } else if (type == FieldType.BYTES) {
            byte[] bb = (byte[]) o;
            if (withTag) {
                out.writeBytes(order, ByteString.copyFrom(bb));
            } else {
                out.writeBytesNoTag(ByteString.copyFrom(bb));
            }
        } else if (type == FieldType.DOUBLE) {
            if (withTag) {
                out.writeDouble(order, (Double) o);
            } else {
                out.writeDoubleNoTag((Double) o);
            }
        } else if (type == FieldType.FIXED32) {
            if (withTag) {
                out.writeFixed32(order, (Integer) o);
            } else {
                out.writeFixed32NoTag((Integer) o);
            }
        } else if (type == FieldType.FIXED64) {
            if (withTag) {
                out.writeFixed64(order, (Long) o);
            } else {
                out.writeFixed64NoTag((Long) o);
            }
        } else if (type == FieldType.FLOAT) {
            if (withTag) {
                out.writeFloat(order, (Float) o);
            } else {
                out.writeFloatNoTag((Float) o);
            }
        } else if (type == FieldType.INT32) {
            if (withTag) {
                out.writeInt32(order, (Integer) o);
            } else {
                out.writeInt32NoTag((Integer) o);
            }
        } else if (type == FieldType.INT64) {
            if (withTag) {
                out.writeInt64(order, (Long) o);
            } else {
                out.writeInt64NoTag((Long) o);
            }
        } else if (type == FieldType.SFIXED32) {
            if (withTag) {
                out.writeSFixed32(order, (Integer) o);
            } else {
                out.writeSFixed32NoTag((Integer) o);
            }
        } else if (type == FieldType.SFIXED64) {
            if (withTag) {
                out.writeSFixed64(order, (Long) o);
            } else {
                out.writeSFixed64NoTag((Long) o);
            }
        } else if (type == FieldType.SINT32) {
            if (withTag) {
                out.writeSInt32(order, (Integer) o);
            } else {
                out.writeSInt32NoTag((Integer) o);
            }
        } else if (type == FieldType.SINT64) {
            if (withTag) {
                out.writeSInt64(order, (Long) o);
            } else {
                out.writeSInt64NoTag((Long) o);
            }
        } else if (type == FieldType.STRING) {
            if (withTag) {
                out.writeBytes(order, ByteString.copyFromUtf8(String.valueOf(o)));
            } else {
                out.writeBytesNoTag(ByteString.copyFromUtf8(String.valueOf(o)));
            }
        } else if (type == FieldType.UINT32) {
            if (withTag) {
                out.writeUInt32(order, (Integer) o);
            } else {
                out.writeUInt32NoTag((Integer) o);
            }
        } else if (type == FieldType.UINT64) {
            if (withTag) {
                out.writeUInt64(order, (Long) o);
            } else {
                out.writeUInt64NoTag((Long) o);
            }
        } else if (type == FieldType.ENUM) {
            int value = 0;
            if (o instanceof EnumReadable) {
                value = ((EnumReadable) o).value();
            } else if (o instanceof Enum) {
                value = ((Enum) o).ordinal();
            }
            if (withTag) {
                out.writeEnum(order, value);

            } else {
                out.writeEnumNoTag(value);
            }
        }
    }
821454
private void writeSimple(Class<?> declaredType, Object value) throws IOException {
        Class<?> realType = value.getClass();
        if (realType == Integer.class) {
            output.writeInt(((Integer) value).intValue());
        } else if (realType == Long.class) {
            output.writeLong(((Long) value).longValue());
        } else if (realType == Short.class) {
            output.writeInt(((Short) value).shortValue());
        } else if (realType == Byte.class) {
            output.writeInt(((Byte) value).byteValue());
        } else if (realType == Float.class) {
            float flt = ((Float) value).floatValue();
            if (Float.isNaN(flt)) {
                // write as string
                output.writeNull();
            } else if (Float.isInfinite(flt)) {
                // write as string
                output.writeString(Float.toString(flt));
            } else {
                output.writeFloat(flt);
            }
        } else if (realType == Double.class) {
            double dbl = ((Double) value).doubleValue();
            if (Double.isNaN(dbl)) {
                // write as string
                output.writeNull();
            } else if (Double.isInfinite(dbl)) {
                // write as string
                output.writeString(Double.toString(dbl));
            } else {
                output.writeDouble(dbl);
            }
        } else if (realType == Boolean.class) {
            output.writeBoolean(((Boolean) value).booleanValue());
        } else {
            // write as a string
            try {
                String converted = settings.getConverter().convertToString(realType, value);
                if (converted == null) {
                    throw new IllegalArgumentException("Unable to write because converter returned a null string: " + value);
                }
                output.writeString(converted);
            } catch (RuntimeException ex) {
                throw new IllegalArgumentException(
                        "Unable to convert type " + declaredType.getName() + " for real type: " + realType.getName(), ex);
            }
        }
    }
129224
public void write(EntityType type) throws ODataRenderException {

        LOG.debug("Writing type {} of type {}", type.getName(), type.getMetaType());
        try {
            xmlWriter.writeStartElement(ENTITY_TYPE);
            if (!isNullOrEmpty(type.getBaseTypeName())) {
                xmlWriter.writeAttribute(BASE_TYPE, type.getBaseTypeName());
            }
            if (type.isOpen()) {
                xmlWriter.writeAttribute(OPEN_TYPE, Boolean.toString(type.isOpen()));
            }
            if (type.hasStream()) {
                xmlWriter.writeAttribute(HAS_STREAM, Boolean.toString(type.hasStream()));
            }
            xmlWriter.writeAttribute(NAME, type.getName());
            if (type.isAbstract()) {
                xmlWriter.writeAttribute(ABSTRACT, "true");
            }
            xmlWriter.writeStartElement(ENTITY_TYPE_KEY);
            for (PropertyRef propertyRef : type.getKey().getPropertyRefs()) {
                xmlWriter.writeStartElement(PROPERTY_REF);
                xmlWriter.writeAttribute(NAME, propertyRef.getPath());
                xmlWriter.writeEndElement();
            }
            xmlWriter.writeEndElement();

            visitProperties(entityDataModel, type, property -> {
                try {
                    propertyWriter.write(property);
                } catch (XMLStreamException e) {
                    throw new ODataRenderException("Error while writing property: " + property.getName(), e);
                }
            });
            xmlWriter.writeEndElement();
        } catch (XMLStreamException e) {
            throw new ODataRenderException("Error while writing entity type: " + type.getName(), e);
        }

    }
297619
public static void setField(Class<?> type, String fieldName, Object fieldValue) {
		setField(null, type, fieldName, fieldValue);
	}
258231
void setScriptType(int type) {

        // OOo related code
        if (database.isStoredFileAccess()) {
            return;
        }

        // OOo end
        boolean needsCheckpoint = scriptFormat != type;

        scriptFormat = type;

        properties.setProperty(HsqlDatabaseProperties.hsqldb_script_format,
                               String.valueOf(scriptFormat));

        if (needsCheckpoint) {
            database.logger.needsCheckpoint = true;
        }
    }
31013
private FieldType getFieldType(byte[] data, int offset)
   {
      int fieldIndex = MPPUtility.getInt(data, offset);
      return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex));
   }
809432
public void write(ByteCodeWriter out)
    throws IOException
  {
    out.writeUTF8Const(getName());
    out.writeIntUTF8(_value);
  }
364464
private void writeTypedBytes(final int type, final byte[] data, final int offset, final int length)
    {
        int totalLength = 1 + length;
        if (length < 14)
        {
            buffer.writeUInt8(type | length);
        }
        else
        {
            // need to specify length explicitly
            buffer.writeUInt8(type | 0xE);
            final int sizeLength = buffer.writeVarUInt(length);
            totalLength += sizeLength;
        }
        updateLength(totalLength);
        buffer.writeBytes(data, offset, length);
    }
590003
public static void writeField(final FieldDescriptorLite<?> descriptor,
                                final Object value,
                                final CodedOutputStream output)
                                throws IOException {
    WireFormat.FieldType type = descriptor.getLiteType();
    int number = descriptor.getNumber();
    if (descriptor.isRepeated()) {
      final List<?> valueList = (List<?>)value;
      if (descriptor.isPacked()) {
        output.writeTag(number, WireFormat.WIRETYPE_LENGTH_DELIMITED);
        // Compute the total data size so the length can be written.
        int dataSize = 0;
        for (final Object element : valueList) {
          dataSize += computeElementSizeNoTag(type, element);
        }
        output.writeRawVarint32(dataSize);
        // Write the data itself, without any tags.
        for (final Object element : valueList) {
          writeElementNoTag(output, type, element);
        }
      } else {
        for (final Object element : valueList) {
          writeElement(output, type, number, element);
        }
      }
    } else {
      if (value instanceof LazyField) {
        writeElement(output, type, number, ((LazyField) value).getValue());
      } else {
        writeElement(output, type, number, value);
      }
    }
  }
506579
private static void writeOriginField(DataOutput out, SerializedField code, Object v)
            throws IOException {
        switch (code) {
        case ORIGIN_DESCRIPTION:
            out.writeUTF((String) v);
            break;
        case ORIGIN_LINE_NUMBER:
            out.writeInt((Integer) v);
            break;
        case ORIGIN_END_LINE_NUMBER:
            out.writeInt((Integer) v);
            break;
        case ORIGIN_TYPE:
            out.writeByte((Integer) v);
            break;
        case ORIGIN_URL:
            out.writeUTF((String) v);
            break;
        case ORIGIN_RESOURCE:
            out.writeUTF((String) v);
            break;
        case ORIGIN_COMMENTS:
            @SuppressWarnings("unchecked")
            List<String> list = (List<String>) v;
            int size = list.size();
            out.writeInt(size);
            for (String s : list) {
                out.writeUTF(s);
            }
            break;
        case ORIGIN_NULL_URL: // FALL THRU
        case ORIGIN_NULL_RESOURCE: // FALL THRU
        case ORIGIN_NULL_COMMENTS:
            // nothing to write out besides code and length
            break;
        default:
            throw new IOException("Unhandled field from origin: " + code);
        }
    }
427861
public void writeClassMethods(CodeType codeType)
    {
        LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
        try   {
            Set<String> methodsIncluded = new HashSet<String>();
            Set<String> methodInterfaces = new HashSet<String>();
            recLogicFile.close();
            while (recLogicFile.hasNext())
            {
                recLogicFile.next();
                if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
                {
                    this.writeThisMethod(codeType);
                    String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
                    if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
                        strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
                    methodsIncluded.add(strMethodName);
                }
                if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false))
                {
                    String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
                    if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
                        strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
                    methodInterfaces.add(strMethodName);                    
                }
            }
            // Now add a empty implementation for any methods that I don't have
            recLogicFile.close();
            while (recLogicFile.hasNext())
            {
                recLogicFile.next();
                String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
                if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
                    strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
                if ((methodInterfaces.contains(strMethodName)) && (!methodsIncluded.contains(strMethodName)))
                    this.writeThisMethod(codeType); // Write a default impl of this method.
            }
            recLogicFile.close();
        } catch (DBException ex)   {
            ex.printStackTrace();
        }
    }
757381
private void writeShort(int s, byte[] buf, int offset) throws IOException {
        buf[offset] = (byte)(s & 0xff);
        buf[offset + 1] = (byte)((s >> 8) & 0xff);
    }