fieldstructure.java

来自「j2me下的1套UI框架.包含j2me开发中会应用的各种低级组件」· Java 代码 · 共 69 行

JAVA
69
字号
package com.jmobilecore.dstore;

/**
 * A <code>FieldStructure</code> represents a description of a record field
 *
 * @author 	Greg Gridin
 */
public class FieldStructure {

    /**
     * The NULL value.
     */
    public static final int NULL = 0x80000000;

    /**
     * The INTEGER type. Value range is from -(2**32-1) to 2**32-1
     */
    public static final int INTEGER = 1;

    /**
     * The BOOLEAN type. Values are <code>true</code> and <code>false</code>
     */
    public static final int BOOLEAN = 2;

    /**
     * The STRING type.
     * First 2 bytes represents offset from beginning of record.
     * Next 2 bytes represents length of string in bytes. (Note: this value could differ from string length)
     */
    public static final int STRING = 3;

    /**
     * The BINARY type.
     * First 2 bytes represents offset from beginning of record.
     * Next 2 bytes represents length of string in bytes.
     */
    public static final int BINARY = 4;

    /**
     * The field name.
     */
    public String name;

    /**
     * The field type.
     */
    public int type;

    /**
     * Creates a field structure.
     * @param  name the field name.
     * @param  type the field type
     */
    public FieldStructure(String name, int type) {

        this.name = name;
        this.type = type;
    }

    /**
     * Reports whether the type defines data of variable size
     * @param  type the field type
     * @return <code>true</code> if type is defines data of variable length, <code>false</code> otherwise
     */
    static public boolean hasVariableLength(int type) {
        return type==STRING || type==BINARY;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?