01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.search.db;
07:
08: import com.sleepycat.db.*;
09:
10: public class Datum extends Dbt {
11:
12: public Datum() {
13: set_flags(Db.DB_DBT_MALLOC);
14: }
15:
16: public Datum(String s) {
17: set(s, Db.DB_DBT_MALLOC);
18: }
19:
20: public Datum(byte[] b) {
21: set(b, Db.DB_DBT_MALLOC);
22: }
23:
24: public void set_data(String s) {
25: set(s, Db.DB_DBT_MALLOC);
26: }
27:
28: public void set_data(byte b[]) {
29: set(b, Db.DB_DBT_MALLOC);
30: }
31:
32: public void set(String s, int flags) {
33: byte b[] = null;
34: try {
35: b = s.getBytes(SOIFDb.ENCODING);
36: } catch (Exception e) {
37: }
38: set(b, flags);
39: }
40:
41: public void set(byte b[], int flags) {
42: super .set_data(b);
43: set_size(b.length); // not needed in BDB 3.3
44: set_flags(flags);
45: }
46:
47: }
|