1 21 package com.db4o.header; 22 23 import com.db4o.*; 24 import com.db4o.ext.*; 25 import com.db4o.inside.*; 26 27 28 31 public class FileHeaderVariablePart1 extends YapMeta{ 32 33 35 42 private static final int LENGTH = 1 + (YapConst.INT_LENGTH * 4) + YapConst.LONG_LENGTH + YapConst.ADDED_LENGTH; 43 44 private final SystemData _systemData; 45 46 public FileHeaderVariablePart1(int id, SystemData systemData) { 47 setID(id); 48 _systemData = systemData; 49 } 50 51 SystemData systemData() { 52 return _systemData; 53 } 54 55 public byte getIdentifier() { 56 return YapConst.HEADER; 57 } 58 59 public int ownLength() { 60 return LENGTH; 61 } 62 63 public void readThis(Transaction trans, YapReader reader) { 64 _systemData.converterVersion(reader.readInt()); 65 _systemData.freespaceSystem(reader.readByte()); 66 _systemData.freespaceAddress(reader.readInt()); 67 readIdentity(trans, reader.readInt()); 68 _systemData.lastTimeStampID(reader.readLong()); 69 _systemData.uuidIndexId(reader.readInt()); 70 } 71 72 public void writeThis(Transaction trans, YapReader writer) { 73 writer.writeInt(_systemData.converterVersion()); 74 writer.append(_systemData.freespaceSystem()); 75 writer.writeInt(_systemData.freespaceAddress()); 76 writer.writeInt(_systemData.identity().getID(trans)); 77 writer.writeLong(_systemData.lastTimeStampID()); 78 writer.writeInt(_systemData.uuidIndexId()); 79 } 80 81 private void readIdentity(Transaction trans, int identityID) { 82 YapFile file = trans.i_file; 83 Db4oDatabase identity = (Db4oDatabase) file.getByID1(trans, identityID); 84 file.activate1(trans, identity, 2); 85 _systemData.identity(identity); 86 } 87 88 } 89 | Popular Tags |