⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 variant.java

📁 用java和windows的word应用的通用编程接口 关联起来
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return toDispatch();
    }

    public native void putCurrency(long in);

    /** puts an object into the */
    public native void putObject(Object in);

    public native void putDouble(double in);

    public native long getCurrency();

    public native void putFloatRef(float in);

    public native void putCurrencyRef(long in);

    public native void putErrorRef(int in);

    public native void putBooleanRef(boolean in);

    public void putObjectRef(Object in) {
        putObject(in);
    }

    public native void putByteRef(byte in);

    public native String getString();

    public native void putString(String in);

    public native float getFloatRef();

    public native long getCurrencyRef();

    public native int getErrorRef();

    public native boolean getBooleanRef();

    public native Object getObjectRef();

    public native byte getByteRef();

    public native float toFloat();

    /**
     * By default toSafeArray makes a deep copy due to the fact that this
     * Variant owns the embedded SafeArray and will destroy it when it gc's
     */
    public SafeArray toSafeArray() {
        return toSafeArray(true);
    }

    public native SafeArray toSafeArray(boolean deepCopy);

    public native void putSafeArrayRef(SafeArray in);

    public native void putSafeArray(SafeArray in);

    public native void noParam();

    /**
     * superceded by SafeArray
     * @throws com.jacob.com.ComFailException
     */ 
    public void putCharArray(Object in) {
        throw new ComFailException("Not implemented");
    }

    public native float getFloat();

    public native void putFloat(float in);

    public void putDispatchRef(Object in) {
        putDispatch(in);
    }

    public Object getDispatchRef() {
        return getDispatch();
    }

    /**
     * superceded by SafeArray
     * @throws com.jacob.com.ComFailException
     */ 
    public void putVariantArrayRef(Variant[] in) {
        throw new ClassCastException("Not implemented");
    }

    /**
     * superceded by SafeArray
     * @throws com.jacob.com.ComFailException
     */ 
    public Variant[] getVariantArrayRef() {
        throw new ClassCastException("Not implemented");
    }

    public native void changeType(short in);

    public void changeType(int in) {
        changeType((short) in);
    }

    public Object toScriptObject() {
        return toDispatch();
    }

    /**
     * public constructor
     */
    public Variant() {
        init();
        putEmpty();
        if (isDebugEnabled()) {
            debug("create " + getClass().getName() + " in thread "
                    + Thread.currentThread().getName());
        }
    }

    /**
     * constructor that calls init() and then putXXX()
     * @param in
     */
    public Variant(int in) {
        init();
        putInt(in);
    }

    /**
     * constructor that calls init() and then putXXX()
     * @param in
     */
    public Variant(double in) {
        init();
        putDouble(in);
    }

    /**
     * constructor that calls init() and then putXXX()
     * @param in
     */
    public Variant(boolean in) {
        init();
        putBoolean(in);
    }

    /**
     * constructor that calls init() and then putXXX()
     * @param in
     */
    public Variant(String in) {
        init();
        putString(in);
    }

    /**
     * constructor that calls init() and then putSafeArrayXXX()
     * @param in
     * @param fByRef is this data by reference or not?
     */
    public Variant(SafeArray in, boolean fByRef) {
        init();
        if (fByRef) {
            putSafeArrayRef(in);
        } else {
            putSafeArray(in);
        }
    }

    /** 
     * constructor that calls two parameter constructor
     * with 1st parameter as object and 2nd parameter as false
     * @param in
     */
    public Variant(Object in) {
        this(in, false);
    }

    /**
     * constructor that accepts the data object and informaton about
     * whether this is by reference or not
     * @param o
     * @param fByRef
     */
    public Variant(Object o, boolean fByRef) {
        init();
        if (o == null) {
            putEmpty();
        } else if (o instanceof Integer) {
            if (fByRef)
                putIntRef(((Integer) o).intValue());
            else
                putInt(((Integer) o).intValue());
        } else if (o instanceof String) {
            if (fByRef)
                putStringRef((String) o);
            else
                putString((String) o);
        } else if (o instanceof Boolean) {
            if (fByRef)
                putBooleanRef(((Boolean) o).booleanValue());
            else
                putBoolean(((Boolean) o).booleanValue());
        } else if (o instanceof Double) {
            if (fByRef)
                putDoubleRef(((Double) o).doubleValue());
            else
                putDouble(((Double) o).doubleValue());
        } else if (o instanceof Float) {
            if (fByRef)
                putFloatRef(((Float) o).floatValue());
            else
                putFloat(((Float) o).floatValue());
        } else if (o instanceof SafeArray) {
            if (fByRef)
                putSafeArrayRef((SafeArray) o);
            else
                putSafeArray((SafeArray) o);
        } else {
            if (fByRef)
                putObjectRef(o);
            else
                putObject(o);
        }
    }

    /**
     * wierd constructor that is no longer supported
     * @param in
     * @param in1
     * @throws com.jacob.com.ComFailException
     */ 
    public Variant(int in, int in1) {
        throw new ComFailException("Not implemented");
    }

    /**
     * wierd constructor that is no longer supported
     * @param in
     * @param in1
     * @throws com.jacob.com.ComFailException
     */ 
    public Variant(int in, boolean in1) {
        throw new ComFailException("Not implemented");
    }

    /**
     * wierd constructor that is no longer supported
     * @param in
     * @param in1
     * @throws com.jacob.com.ComFailException
     */ 
    public Variant(int in, double in1) {
        throw new ComFailException("Not implemented");
    }

    /**
     * wierd constructor that is no longer supported
     * @param in
     * @param in1
     * @throws com.jacob.com.ComFailException
     */ 
    public Variant(int in, Object in1) {
        throw new ComFailException("Not implemented");
    }

    public native short getvt();

    public native short toShort();

    /**
     * now private so only this object can asccess was: call this to explicitly
     * release the com object before gc
     *  
     */
    private native void release();

    protected native void init();

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#finalize()
     */
    protected void finalize() {
        super.safeRelease();
        safeRelease();
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.jacob.com.JacobObject#safeRelease()
     */
    public void safeRelease() {
        super.safeRelease();
        if (m_pVariant != 0) {
            release();
            m_pVariant = 0;
        } else {
            // looks like a double release
            // this should almost always happen due to gc
            // after someone has called ComThread.Release
            if (isDebugEnabled()) {
                debug(this.getClass().getName() + ":" + this.hashCode()
                        + " double release");
                //Throwable x = new Throwable();
                //x.printStackTrace();
            }
        }
    }

    // superceded by SafeArray
    public Variant[] toVariantArray() {
        throw new ClassCastException("Not implemented");
    }

    // superceded by SafeArray
    public Object toByteArray() {
        throw new ClassCastException("Not implemented");
    }

    static {
        System.loadLibrary("jacob");
    }

    /**
     * custom serialization support
     * @param oos
     */
    private void writeObject(java.io.ObjectOutputStream oos) {
        try {
            Save(oos);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * custom serialization support
     * @param ois
     */
    private void readObject(java.io.ObjectInputStream ois) {
        try {
            Load(ois);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     *  is the variant null or empty or error or null disp
     * @return true if it is null or false if not
     */ 
    public native boolean isNull();

    public native void Save(java.io.OutputStream os) throws java.io.IOException;

    public native void Load(java.io.InputStream is) throws java.io.IOException;

}

⌨️ 快捷键说明

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