KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quadcap > sql > index > BCursor


1 package com.quadcap.sql.index;
2
3 /* Copyright 1997 - 2003 Quadcap Software. All rights reserved.
4  *
5  * This software is distributed under the Quadcap Free Software License.
6  * This software may be used or modified for any purpose, personal or
7  * commercial. Open Source redistributions are permitted. Commercial
8  * redistribution of larger works derived from, or works which bundle
9  * this software requires a "Commercial Redistribution License"; see
10  * http://www.quadcap.com/purchase.
11  *
12  * Redistributions qualify as "Open Source" under one of the following terms:
13  *
14  * Redistributions are made at no charge beyond the reasonable cost of
15  * materials and delivery.
16  *
17  * Redistributions are accompanied by a copy of the Source Code or by an
18  * irrevocable offer to provide a copy of the Source Code for up to three
19  * years at the cost of materials and delivery. Such redistributions
20  * must allow further use, modification, and redistribution of the Source
21  * Code under substantially the same terms as this license.
22  *
23  * Redistributions of source code must retain the copyright notices as they
24  * appear in each source code file, these license terms, and the
25  * disclaimer/limitation of liability set forth as paragraph 6 below.
26  *
27  * Redistributions in binary form must reproduce this Copyright Notice,
28  * these license terms, and the disclaimer/limitation of liability set
29  * forth as paragraph 6 below, in the documentation and/or other materials
30  * provided with the distribution.
31  *
32  * The Software is provided on an "AS IS" basis. No warranty is
33  * provided that the Software is free of defects, or fit for a
34  * particular purpose.
35  *
36  * Limitation of Liability. Quadcap Software shall not be liable
37  * for any damages suffered by the Licensee or any third party resulting
38  * from use of the Software.
39  */

40
41 import java.io.IOException JavaDoc;
42
43 /**
44  * BCursor
45  *
46  * @author Stan Bailes
47  */

48 public interface BCursor {
49     // Cursor positioning
50

51     /**
52      * Seek to (before) the specified key
53      */

54     boolean seek(byte[] key, int len) throws IOException JavaDoc;
55
56     /**
57      * Seek to (before) the specified key
58      */

59     boolean seek(byte[] buf) throws IOException JavaDoc;
60
61     /**
62      * Position cursor before the first record
63      */

64     void beforeFirst() throws IOException JavaDoc;
65
66     /**
67      * Position the cursor after the last record
68      */

69     void afterLast() throws IOException JavaDoc;
70
71     /**
72      * Move to the specified record; one-based.
73      * -1 means last record, -2 means next to last, etc.
74      * @return <b>true</b> if the specified record exists.
75      */

76     boolean absolute(int x) throws IOException JavaDoc;
77
78     /**
79      * Move past the next record and return true the cursor is
80      * now pointed at a valid record.
81      */

82     boolean next() throws IOException JavaDoc;
83
84     /**
85      * Move before the previous record and return true the cursor is
86      * now pointed at a valid record.
87      */

88     boolean prev() throws IOException JavaDoc;
89
90     int getKey(byte[] buf) throws IOException JavaDoc;
91     byte[] getKeyBuf();
92     void setKeyBuf(byte[] buf);
93     int getKeyLen();
94     byte[] getKey(); // XXX a crutch.
95

96     int getVal(byte[] buf) throws IOException JavaDoc;
97     byte[] getValBuf();
98     void setValBuf(byte[] buf);
99     int getValLen();
100     byte[] getVal(); // XXX a crutch.
101

102     long getValAsLong() throws IOException JavaDoc;
103
104     long size() throws IOException JavaDoc;
105     long position() throws IOException JavaDoc;
106
107     /**
108      * Release this cursor back to the pool
109      */

110     void release();
111
112     /**
113      * Release any resources held by this cursor (but maintain ownership of
114      * it -- it can be resurrected by another positioning call.
115      */

116     void close() throws IOException JavaDoc;
117
118     /**
119      * Delete the currently positioned record
120      */

121     boolean delete() throws IOException JavaDoc;
122
123     /**
124      * Insert a new key/data pair. We are presumably positioned just before
125      * the spot where the new record should go, but we will check, anyway.
126      */

127     boolean insert(byte[] key, int klen,
128                    byte[] data, int doff, int dlen) throws IOException JavaDoc;
129     boolean insert(byte[] key, byte[] data) throws IOException JavaDoc;
130
131     /**
132      * Replace the data portion of the current item with the specified data
133      */

134     boolean replace(byte[] data, int doff, int dlen) throws IOException JavaDoc;
135     boolean replace(byte[] data) throws IOException JavaDoc;
136
137 }
138
Popular Tags