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

MultipleDataEntry.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: MultipleDataEntry.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 MultipleDataEntry extends MultipleEntry {
00016     public MultipleDataEntry() {
00017         super(null, 0, 0);
00018     }
00019 
00020     public MultipleDataEntry(final byte[] data) {
00021         super(data, 0, (data == null) ? 0 : data.length);
00022     }
00023 
00024     public MultipleDataEntry(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;
00038     }
00039 
00040     public boolean next(final DatabaseEntry data) {
00041         if (pos == 0)
00042             pos = ulen - INT32SZ;
00043 
00044         final int dataoff = DbUtil.array2int(this.data, pos);
00045 
00046         // crack out the data offset and length.
00047         if (dataoff < 0) {
00048             return (false);
00049         }
00050 
00051         pos -= INT32SZ;
00052         final int datasz = DbUtil.array2int(this.data, pos);
00053 
00054         pos -= INT32SZ;
00055 
00056         data.setData(this.data);
00057         data.setSize(datasz);
00058         data.setOffset(dataoff);
00059 
00060         return (true);
00061     }
00062 }

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