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

📄 deathobject.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: DeathObject.java,v 1.5 2000/10/28 16:55:17 daniela Exp $package org.ozoneDB.core.classicStore;import org.ozoneDB.core.*;import org.ozoneDB.util.*;import org.ozoneDB.DxLib.*;import org.ozoneDB.OzoneCompatible;import java.io.*;/** * stellt einen eintrag in die objektliste des clusterspaces dar; * obj ist die objekt id des ref. objektes; * data der datenteil des objektes in byte form */public class DeathObject extends DxObject {    public final static byte FREE = 0;    public final static byte DELETED = 1;    public final static byte FROZEN = 2;    public final static byte CHANGED = 3;        protected ObjectID oid;    protected byte[] data;    protected long size;    /**     * will be set while read the object state chunk (see     * Cluster.readObjects() and Cluster.appendObject())     */    protected long stateSize;    protected byte state = FREE;        /** References for the double linked list */    public DeathObject previous;    public DeathObject next;            public DeathObject() {    }            public DeathObject( ObjectID _oid ) {        oid = _oid;    }            public final ObjectID objID() {        return oid;    }             public final byte[] data() {        return data;    }             public final void setData( byte[] _data ) {        data = _data;        setSize( data.length );    }             public final long size() {        return size;    }             public final void setSize( long s ) {        size = s;    }             public final byte state() {        return state;    }             public final ClusterID clusterID() {        return container().clusterID();    }             public final void setCluID( ClusterID _cid ) {        container().setClusterID( _cid );    }             public final ClassicObjectContainer container() {        return (ClassicObjectContainer)((ClassicStore)Env.currentEnv().store).objectSpace.objectForID( oid );    }             public final void setState( byte s ) {        state = s;        // Speicher freigeben, da DeathObject selbst nicht sofort aus dem        // ClusterSpace geloescht wird, sondern in priorityQueue referenziert        // wird.        if (state == DELETED) {            data = null;            oid = null;        }     }             public OzoneCompatible enlive() throws IOException {        if (data != null) {            try {                //env.logWriter.newEntry ("enlive data size: " + data.length, LogWriter.DEBUG3);                ByteArrayInputStream bs = new ByteArrayInputStream( data );                ObjectInput in = new ObjectInputStream( bs );                OzoneCompatible obj = (OzoneCompatible)in.readObject();                in.close();                bs.close();                                // NEW: if an object is activated, we don't need the data any longer                data = null;                                return obj;            } catch (Exception e) {                Env.currentEnv().logWriter.newEntry( this, e.toString(), LogWriter.WARN );                throw new IOException( e.toString() );            }         }         return null;    } }

⌨️ 快捷键说明

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