KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > utils > byteconverter > CUbcmfLfzIboemfs


1 package com.daffodilwoods.daffodildb.utils.byteconverter;
2
3 import com.daffodilwoods.daffodildb.utils.*;
4 import com.daffodilwoods.daffodildb.utils.field.*;
5 import com.daffodilwoods.database.resource.*;
6 import com.daffodilwoods.daffodildb.server.datasystem.persistentsystem.TableKey;
7 import com.daffodilwoods.daffodildb.server.datasystem.persistentsystem.DatabaseConstants;
8
9 public class CUbcmfLfzIboemfs implements CbCUsffWbmvfIboemfs{
10   static int TABLEKEY_LENGTH = 6;
11     public CUbcmfLfzIboemfs() {
12     }
13
14     public byte[] getBytes(Object JavaDoc object) throws DException{
15         TableKey key = (TableKey)object;
16         byte[] bytes = new byte[10];
17         byte[] addressBytes = CCzufDpowfsufs.getBytes(key.getStartAddress());
18         byte[] recordNumberBytes = CCzufDpowfsufs.getBytes(key.getRecordNumber());
19         System.arraycopy(addressBytes,0,bytes,0,addressBytes.length);
20         System.arraycopy(recordNumberBytes,0,bytes,addressBytes.length,recordNumberBytes.length);
21         return bytes;
22     }
23
24
25     public Object JavaDoc getObject(byte[] bytes) throws DException{
26         int add = CCzufDpowfsufs.getIntValue(bytes,0);
27         short rec = CCzufDpowfsufs.getShortValue(bytes,4);
28         return new TableKey(add,rec);
29     }
30
31     public FieldBase getObject(BufferRange buffer,int datatype) throws DException {
32         return new FieldTableKey(buffer,datatype);
33     }
34
35     public boolean isVariable() throws DException{
36       
37     throw new java.lang.UnsupportedOperationException JavaDoc("Method isVariable() not yet implemented.");
38     }
39
40     public int getLength() throws DException{
41       return TABLEKEY_LENGTH;
42     }
43 }
44
Popular Tags