• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/java/src/com/sleepycat/db/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002,2008 Oracle.  All rights reserved.
5 *
6 * $Id: MultipleEntry.java,v 12.10 2008/01/17 05:04:53 mjc Exp $
7 */
8
9package com.sleepycat.db;
10
11import com.sleepycat.db.internal.DbConstants;
12
13import java.nio.ByteBuffer;
14
15/**
16An abstract class representing a DatabaseEntry that holds multiple results
17returned by a single {@link com.sleepycat.db.Cursor Cursor} get method.  Use one of the concrete
18subclasses depending on whether you need:
19<ul>
20<li>multiple data items only: {@link com.sleepycat.db.MultipleDataEntry MultipleDataEntry}</li>
21<li>multiple key / data item pairs: {@link com.sleepycat.db.MultipleKeyDataEntry MultipleKeyDataEntry}</li>
22<li>multiple record number / data item pairs:
23{@link com.sleepycat.db.MultipleRecnoDataEntry MultipleRecnoDataEntry}</li>
24</ul>
25*/
26public abstract class MultipleEntry extends DatabaseEntry {
27    /* package */ int pos;
28
29    /* package */ MultipleEntry(final byte[] data, final int offset, final int size) {
30        super(data, offset, size);
31        setUserBuffer((data != null) ? (data.length - offset) : 0, true);
32    }
33
34    /* package */ MultipleEntry(final ByteBuffer data) {
35        super(data);
36    }
37
38    public void setUserBuffer(final int length, final boolean usermem) {
39        if (!usermem)
40            throw new IllegalArgumentException("User buffer required");
41        super.setUserBuffer(length, usermem);
42    }
43}
44