00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.db;
00011
00012 import com.sleepycat.db.internal.DbConstants;
00013 import com.sleepycat.db.internal.DbUtil;
00014
00015 public class MultipleKeyDataEntry extends MultipleEntry {
00016 public MultipleKeyDataEntry() {
00017 super(null, 0, 0);
00018 }
00019
00020 public MultipleKeyDataEntry(final byte[] data) {
00021 super(data, 0, (data == null) ? 0 : data.length);
00022 }
00023
00024 public MultipleKeyDataEntry(final byte[] data,
00025 final int offset,
00026 final int size) {
00027 super(data, offset, size);
00028 }
00029
00034
00035 int getMultiFlag() {
00036 pos = 0;
00037 return DbConstants.DB_MULTIPLE_KEY;
00038 }
00039
00040 public boolean next(final DatabaseEntry key, final DatabaseEntry data) {
00041 if (pos == 0)
00042 pos = ulen - INT32SZ;
00043
00044 final int keyoff = DbUtil.array2int(this.data, pos);
00045
00046
00047 if (keyoff < 0)
00048 return false;
00049
00050 pos -= INT32SZ;
00051 final int keysz = DbUtil.array2int(this.data, pos);
00052 pos -= INT32SZ;
00053 final int dataoff = DbUtil.array2int(this.data, pos);
00054 pos -= INT32SZ;
00055 final int datasz = DbUtil.array2int(this.data, pos);
00056 pos -= INT32SZ;
00057
00058 key.setData(this.data);
00059 key.setOffset(keyoff);
00060 key.setSize(keysz);
00061
00062 data.setData(this.data);
00063 data.setOffset(dataoff);
00064 data.setSize(datasz);
00065
00066 return true;
00067 }
00068 }