KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > util > StringDbt


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: StringDbt.java,v 1.12 2006/10/30 21:14:54 bostic Exp $
7  */

8
9 package com.sleepycat.je.util;
10
11 import com.sleepycat.je.DatabaseEntry;
12
13 public class StringDbt extends DatabaseEntry {
14     public StringDbt() {
15     }
16
17     public StringDbt(String JavaDoc value) {
18     setString(value);
19     }
20
21     public StringDbt(byte[] value) {
22     setData(value);
23     }
24
25     public void setString(String JavaDoc value) {
26     byte[] data = value.getBytes();
27     setData(data);
28     }
29
30     public String JavaDoc getString() {
31     return new String JavaDoc(getData(), 0, getSize());
32     }
33     
34     public String JavaDoc toString() {
35         return getString();
36     }
37 }
38
39
Popular Tags