Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

MultipleRecnoDataEntry.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2002-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: MultipleRecnoDataEntry.java,v 12.2 2005/10/11 17:54:23 mark Exp $
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 MultipleRecnoDataEntry extends MultipleEntry {
00016     public MultipleRecnoDataEntry() {
00017         super(null, 0, 0);
00018     }
00019 
00020     public MultipleRecnoDataEntry(final byte[] data) {
00021         super(data, 0, (data == null) ? 0 : data.length);
00022     }
00023 
00024     public MultipleRecnoDataEntry(final byte[] data,
00025                                   final int offset,
00026                                   final int size) {
00027         super(data, offset, size);
00028     }
00029 
00034     /* package */
00035     int getMultiFlag() {
00036         pos = 0;
00037         return DbConstants.DB_MULTIPLE_KEY;
00038     }
00039 
00040     public boolean next(final DatabaseEntry recno, final DatabaseEntry data) {
00041         if (pos == 0)
00042             pos = ulen - INT32SZ;
00043 
00044         final int keyoff = DbUtil.array2int(this.data, pos);
00045 
00046         // crack out the key offset and the data offset and length.
00047         if (keyoff < 0)
00048             return false;
00049 
00050         pos -= INT32SZ;
00051         final int dataoff = DbUtil.array2int(this.data, pos);
00052         pos -= INT32SZ;
00053         final int datasz = DbUtil.array2int(this.data, pos);
00054         pos -= INT32SZ;
00055 
00056         recno.setData(this.data);
00057         recno.setOffset(keyoff);
00058         recno.setSize(INT32SZ);
00059 
00060         data.setData(this.data);
00061         data.setOffset(dataoff);
00062         data.setSize(datasz);
00063 
00064         return true;
00065     }
00066 }

Generated on Sun Dec 25 12:14:33 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2